android - Request correct permissions to save an SMS on Inbox
I want my Android program to be able to save 开发者_StackOverflow社区an SMS on the user's inbox.
I already found this question which does exactly that, but this statement:getContentResolver().insert(Uri.parse("content://sms/sent"), values);
throws a SecurityException
.
I already requested the SMS_WRITE
permission in the manifest file.
Took me some time too, seems like you also need the READ_SMS permission
(found it there: http://www.andreabaccega.com/blog/2010/08/12/write-an-sms-without-sending-it-on-android-2-2-froyo/)
worked for me.
Because the original SMS application uses this ContentResolver, you can retrieve it but as CW said, it may or may not be there. However; from my experience most applications that deal with SMS and interaction actually read the SMS ContentProvider (com.android.providers.telephony).
The permission name is WRITE_SMS... maybe that is the problem.
精彩评论