Permission Denial: requires android.permission.READ_PHONE_STATE

后端 未结 1 893
小蘑菇
小蘑菇 2021-01-05 22:09

I\'m trying to detect phone calls in my android app but I receive the following message when receiving a call:

08-23 15:16:04.685  Vodafone VFD 600    Warnin         


        
相关标签:
1条回答
  • 2021-01-05 22:54

    Firstly, third-party apps are not permitted to acquire the READ_PRIVILEGED_PHONE_STATE permission. See Privileged Permission Whitelisting:

    Privileged applications are system applications located in the /system/priv-app directory on the system image. Historically, device implementers had little control over which signature|privileged permissions could be granted to privileged apps. Starting in Android 8.0, implementors can explicitly whitelist privileged apps in the system configuration XML files in the /etc/permissions directory. Apps not explicitly listed in these XML files are not granted privileged permissions.

    Secondly, when your app is running on API 23 and above, you'll need to first ask the user to grant you the READ_PHONE_STATE permission at runtime, as it is considered a "dangerous" permission (see Permissions Overview).

    You'll need to follow the instructions at Request App Permissions to request the permission from the user at runtime, and only once that permission is granted can your BroadcastReceiver receive the intents.

    0 讨论(0)
提交回复
热议问题