Thursday, July 23, 2009

Android Security Exception (Inbox Outbox access)

Guys, I am getting the following Security Exception while trying to Insert/put SMS in Android DataBase ( Inbox ).


ERROR/DatabaseUtils(603): java.lang.SecurityException: Permission Denial: reading com.android.providers.telephony.MmsSmsProvider uri content://mms-sms/threadID?


Any suggestions... :)




After Some Time :-


Yes!!!!!


Hay gusy I got it.




Though I am writing to the database of android, I should also provide read permission.


Below is the code for read permission, should be added in Manifest.xml.




Below is the code to perform insert operation into the Inbox of android phone.


ContentValues values = new ContentValues();
values.put(SMSHelper.ADDRESS, "+919704044004");
values.put(SMSHelper.DATE, "1237080365055");
values.put(SMSHelper.READ, 1);
values.put(SMSHelper.STATUS, -1);
values.put(SMSHelper.TYPE, 2);
values.put(SMSHelper.BODY, "SMS inserting test... Basheer");
Uri inserted = getContentResolver().insert(Uri.parse("content://sms"), values);
Log.d("Inbox","SMS In Inbox...");


Cheers!!!



2 comments:

  1. hey where is the manifest.xml?? I am despritly seeking for it?? i am stuck in similar problem while reading the SMS inbox;

    ReplyDelete
  2. What about SMSHelper.It shows error that cannot be resolved.is that a seperate class?please upload the full code.

    ReplyDelete