android - Request correct permissions to save an SMS on Inbox

橙三吉。 提交于 2019-12-13 01:43:54

问题


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

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