Sending Sms Programatically Doesn't Save It To Sent Items
I am sending an SMS programmatically from my app. The sent message is not saved in Sent Items folder. I have read few posts, especially this one... http://android-developers.blogsp
Solution 1:
You can save Message Pragmatically, in sent items or in inbox.
publicbooleanrestoreSms(Sms obj) {
booleanret=false;
try {
ContentValuesvalues=newContentValues();
values.put("address", obj.getAddress());
values.put("body", obj.getMsg());
values.put("read", obj.getReadState());
values.put("date", obj.getTime());
mActivity.getContentResolver().insert(
Uri.parse("content://sms/sent", values);
//Uri.parse("content://sms/inbox", values);
ret = true;
} catch (Exception ex) {
ret = false;
}
return ret;
}
Use this permission in AndroidManifest
<uses-permissionandroid:name="android.permission.WRITE_SMS" />
Solution 2:
Use the builtin sms app for sending the sms, have a look at this post with a code snippet how to do this: launch sms application with an intent
Post a Comment for "Sending Sms Programatically Doesn't Save It To Sent Items"