Android Write to default SMS App

大兔子大兔子 提交于 2019-12-24 08:58:09

问题


My Android App is using the following code to send an SMS Message:

SmsManager sms = SmsManager.getDefault();
    sms.sendTextMessage(smsMessage.getNumber(), null, smsMessage.getText(), sentPI, deliveredPI);  

However, is it possible to save the outgoing message so that it is displayed in the default SMS app, just as if the user used the default app to send it?

Thanks


回答1:


you must insert your smsMessage into default SMS_database
like this

public void insertSMS(String address,String body){
private ContentResolver resolver = null;
resolver = context.getContentResolver();//context is your instance of Activity 
ContentValues values = new ContentValues();
values.put("address", address);
values.put("body", body);
resolver.insert(Uri.parse("content://sms/sent"), values);

}



来源:https://stackoverflow.com/questions/9746398/android-write-to-default-sms-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!