gpt4 book ai didi

android - 如何请求权限 : READ_PRIVILEGED_PHONE_STATE?

转载 作者:行者123 更新时间:2023-12-04 13:55:56 32 4
gpt4 key购买 nike

如何请求“android.permission.READ_PRIVILEGED_PHONE_STATE”权限?我知道从 Android 10 开始,从 Google Play 商店安装的第三方应用程序无法声明特权。

https://developer.android.com/about/versions/10/privacy/changes#data-ids

但是,我的应用程序不会与 Google Play 商店一起分发。我将共享 apk 文件,用户将手动安装应用程序。

我已在 list 中声明许可:

<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />

我也试图将它作为任何常规许可来请求:
if(ActivityCompat.checkSelfPermission(this.getApplicationContext(), "android.permission.READ_PRIVILEGED_PHONE_STATE") != PackageManager.PERMISSION_GRANTED)        {
ActivityCompat.requestPermissions(this, new String[]{"android.permission.READ_PRIVILEGED_PHONE_STATE"},123);
}

但什么都没有发生。系统不会提示我授予此权限。没有显示警报对话框。我如何申请此权限?

最佳答案

您不能将此权限用于 android 10 版本。您可以将 targetSdkVersion 更改为低于 29

Android 10 changes the permissions for device identifiers so that all device identifiers are now protected by the READ_PRIVILEGED_PHONE_STATE permission.The READ_PRIVILEGED_PHONE_STATE permission is only granted to apps signed with the platform key and privileged system apps.



引用:

https://source.android.com/devices/tech/config/device-identifiers

关于android - 如何请求权限 : READ_PRIVILEGED_PHONE_STATE?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62432174/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com