访问Android 10的设备所有者应用的getDeviceID吗?

问题描述

我有很多电话,需要在带有IMEI条形码的数据库注册并在其上安装公司应用程序以进行连接和跟踪。为此,我需要使用getdeviceid()访问IMEI。从Android 10开始,它并不那么简单。

在此页面中,Android表示如果您是设备所有者,则可以访问它:https://developer.android.com/training/articles/user-data-ids

我使用这种方法使我的应用成为设备所有者应用: How to make my app a device owner?

adb shell dpm set-device-owner com.package.name/.MyDeviceAdminReceiver 

当我在应用程序中使用getdeviceid()时,仍然出现错误

 java.lang.SecurityException: getdeviceid: The user 10180 does not meet the requirements to access device identifiers.

为什么这种方法不起作用? 您对IMEI有什么建议吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)