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.
Android 10 changes the permissions for device identifiers so that all device identifiers are now protected by the READ_PRIVILEGED_PHONE_STATE permission. Prior to Android 10, persistent device identifiers (IMEI/MEID, IMSI, SIM, and build serial) were protected behind the READ_PHONE_STATE runtime permission.
permission. READ_PHONE_STATE - You must ask the end user to grant this permission.) Allows read only access to the phone's state, and is used to determine the status of any ongoing calls. You need this permission so you can verify that your end user receives a phone call from TeleSign. android.
Permission CALL_PHONE belong to dangerous permission group. So if your apps target SDK is 23 or higher and your device is running on Android 6.0 or higher, you must request for CALL_PHONE permission while the app is running. Example : String number = ("tel:" + numTxt.
READ_PRIVILEGED_PHONE_STATE is privileged | signature permission and 3rd party apps cannot have this permission.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With