1

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?

Community
  • 1
  • 1
Verena
  • 11
  • 1
  • 2
  • 3
    The SMS content provider is not part of the Android SDK. Your code will break on devices that replace the SMS client with their own. Your code may break in future versions of Android. http://android-developers.blogspot.com/2010/05/be-careful-with-content-providers.html – CommonsWare May 29 '10 at 16:36
  • 1
    OK, this explains the unavailability of any documentation. Too bad, then I assume that there is no generic SMS store at all? Somehow strange for an mobile phone SDK I think. – Verena May 30 '10 at 20:53

3 Answers3

2

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.

pinkwerther
  • 313
  • 4
  • 10
1

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).

JoxTraex
  • 13,423
  • 6
  • 32
  • 45
0

The permission name is WRITE_SMS... maybe that is the problem.

Deepank Gupta
  • 1,597
  • 3
  • 12
  • 11