madiya madiya
madiya madiya

Reputation: 35

Permission declared still permission denied

I have declared all the permission required (in fact even those which are not required) but still getting error of "permission Denial" and java.lang.RuntimeException. Basically, I am just reading the various ID including wifi and BT and sending an sms.

Error log.

E/AndroidRuntime(5260): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ketan.mid/com.ketan.mid.MainActivity}: java.lang.SecurityException: Permission Denial: reading com.android.providers.telephony.MmsSmsProvider uri content://mms-sms/threadID?recipient=9123456789&createthread=true from pid=5260, uid=10108 requires android.permission.READ_SMS

Here is the permission declared.

<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.WRITE_SMS"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_MMS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED"/>

Pl help me to find out whats wrong.

Thanks.

Upvotes: 0

Views: 1137

Answers (2)

Sripathi
Sripathi

Reputation: 1780

You just need to add android.permission.READ_SMS. Because android.permission.WRITE_SMS is the permission to write SMS from the app. We need to add android.permission.READ_SMS explicitly.

Refer the following documentation http://developer.android.com/reference/android/Manifest.permission.html#WRITE_SMS http://developer.android.com/reference/android/Manifest.permission.html#READ_SMS

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1006674

I have declared all the permission required

The error has requires android.permission.READ_SMS, and you have not requested that permission. While in many cases "write implies read", perhaps that is not supported here.

Upvotes: 3

Related Questions