Android Q 限制对 IMEI 和序列号的访问。它仅适用于具有特殊运营商许可的平台和应用程序。此外,权限 READ_PRIVILEGED_PHONE_STATE 不适用于非平台应用程序。
现有版本(Android P、Android O、Android M)我们使用序列号来唯一标识设备。现在,我们在尝试访问设备标识符时遇到了以下异常。
Android Q 限制对 IMEI 和序列号的访问。
06-21 12:37:07.460 1250 2555 W DevicePolicyManager: Package com.nagra.nmp.corepaktest (uid=10201, pid=32694) cannot access Device IDs
06-21 12:37:07.460 1250 2555 W TelephonyPermissions: reportAccessDeniedToReadIdentifiers:com.nagra.nmp.corepaktest:getSerial:isPreinstalled=false:isPrivApp=false
06-21 12:37:07.464 32694 32718 W System.err: java.lang.SecurityException: getSerial: The user 10201 does not meet the requirements to access device identifiers.
06-21 12:37:07.464 32694 32718 W System.err: at android.os.Parcel.createException(Parcel.java:2069)
06-21 12:37:07.464 32694 32718 W System.err: at android.os.Parcel.readException(Parcel.java:2037)
06-21 12:37:07.465 32694 32718 …Run Code Online (Sandbox Code Playgroud) android ×1