gpt4 book ai didi

android - Build.GetSerial() 在 API 29 上返回未知数

转载 作者:行者123 更新时间:2023-12-03 13:28:20 29 4
gpt4 key购买 nike

我无法在 android 10 设备上获取序列号。

我知道一切(权限,运行时权限,我只有在获得权限后才能获得串行)从这里
android Build.GetSerial() throwing exception

我的代码适用于所有 android 版本,除了 10

你有什么想法?

最佳答案

如果您在此处遵循官方文档:https://developer.android.com/reference/android/os/Build.html#getSerial() ,有关 Android 10 更改的更多信息 here
您会注意到,从 Android 10 开始,此方法返回 Build.UNKNOWN .您不能再使用它来唯一标识单个设备
您需要切换到名为 Settings.Secure.ANDROID_ID 的“更少”持久版本。
绕过此限制的唯一方法是:

  1. Create a system app to be able to get the READ_PRIVILEGED_PHONE_STATE system permission (a normal app can't get this).
  2. Be registered as a carrier (which requires you to have built the Android ROM)
  3. Have a custom "work profile" to set your own policies in the device.

可以想象,所有这些选项都不适合标准的 android 应用程序开发人员使用

关于android - Build.GetSerial() 在 API 29 上返回未知数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59326190/

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