简体   繁体   中英

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM