我正在尝试开发Android Management API +信息亭应用。
我想从信息亭应用中获取设备ID(enterprises/xxxxx/devices/xxxxx
)。
我的目的是将设备ID与在应用中创建的信息亭应用ID关联。
我可以从信息亭应用中获取设备ID吗?还有其他解决方案吗?
答案 0 :(得分:1)
您的应用程序无法直接访问设备ID。
不过,您可以通过在应用程序中使用一个字符串exposing a managed configuration并在ApplicationPolicy
中为每个设备配置不同的策略来实现相似的结果。托管配置可以包含一个字符串属性,您可以将其设置为每个设备的设备ID。
您应用中的托管配置文件如下:
<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
<restriction
android:key="deviceId"
android:title="ID of the device"
android:restrictionType="string" />
</restrictions>
政策如下:
{
"applications": [
{
"packageName": "com.example",
"installType": "FORCE_INSTALLED",
"managedConfiguration": {
"deviceId": "1a2b3c4d5e6f"
}
}
]
}
此外,要在注册新设备后立即设置策略,您可以set up Pub/Sub notifications并监听ENROLLMENT
事件,通知的data
字段包含{{1 }}资源和设备ID,因此允许您创建新策略并将其分配给设备。