问题
I want my Android program to be able to save 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.
Any ideas?
回答1:
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.
回答2:
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).
回答3:
The permission name is WRITE_SMS... maybe that is the problem.
来源:https://stackoverflow.com/questions/2935783/android-request-correct-permissions-to-save-an-sms-on-inbox