Reputation: 2728
I want to block incoming sms using my app. But, when user disable the blocking, I want all the previously blocked messages to go back to Inbox. I am aborting the sms using abortBroadcast() in smsBroadcastReceiver. How to resend these messages to inbox later? Do I have do something like saving the broadcasts and resend them later?
Upvotes: 0
Views: 63
Reputation: 47965
Store all incoming sms in your own database. After the user is unblocked you can recover the sms as Josef Pfleger wrote in one of his answers:
You can use the sms content provider to read and write sms messages:
ContentValues values = new ContentValues();
values.put("address", "123456789");
values.put("body", "foo bar");
getContentResolver().insert(Uri.parse("content://sms/inbox"), values);
However, the
sms://
content provider is not part of the SDK so I strongly recommend not using code like this in public applications for several reasons.
It seems to be the most populare way however it is not official.
Upvotes: 1