READ_PRIVILEGED_PHONE_STATE permission error
android, broadcastreceiver, crash, permissions
Solution
READ_PRIVILEGED_PHONE_STATE is privileged | signature permission and 3rd party apps cannot have this permission.
Problem
I have created an app that monitors calls (incoming and outgoing) and during the time that phone is ringing , it shows details about the number. everything is fine in incoming calls , but when user make an outgoing call app crashes with this error : ``` 05-14 23:14:36.376 1427-1475/? W/BroadcastQueue: Permission Denial: receiving Intent { act=android.intent.action.PHONE_STATE flg=0x10 (has extras) } to ir.apptune.antispam/.CallReceiver requires android.permission.READ_PRIVILEGED_PHONE_STATE due to sender android (uid 1000) ``` here is the details about sdk version that i use : ``` minSdkVersion 14 targetSdkVersion 22 versionCode 1 versionName "1.0" ``` permissions that i granted : ``` <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" /> <uses-permission android:name="android.permission.READ_CALL_LOG" /> <uses-permission android:name="android.permission.CALL_PHONE" /> ``` Also i have checked in run time if permissions are granted. and it returns 0 means yes. but still same error. also please consider the Broadcast receiver declaration in manifest: ``` <receiver android:name=".CallReceiver" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.intent.action.PHONE_STATE" /> </intent-filter> </receiver> ``` any help is appreciated.