有什么方法可以从应用程序获取Android Management API设备ID [英] Is there any way to get Android Management API device id from app

查看:101
本文介绍了有什么方法可以从应用程序获取Android Management API设备ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发Android Management API +信息亭应用.

I'm trying to develop Android Management API + kiosk app.

我想从信息亭应用中获取设备ID( enterprises/xxxxx/devices/xxxxx ).
我的目的是将设备ID与在应用中创建的信息亭应用ID关联.

I want to get the device id(enterprises/xxxxx/devices/xxxxx) from kiosk app.
My purpose is to associate the device id with kiosk app id which created in app.

我可以从信息亭应用中获取设备ID吗?还有其他解决方案吗?

Can I get the device id from kiosk app? Is there any other solution?

推荐答案

您的应用程序无法直接访问设备ID.

It is not possible for your app to directly access the device ID.

不过,您可以通过在应用程序中公开托管配置来获得相似的结果使用一个字符串并在 ApplicationPolicy中进行配置 (针对每个设备使用不同的策略).托管配置可以包含一个字符串属性,您可以将其设置为每个设备的设备ID.

However you can achieve a similar result by exposing a managed configuration in your app with one string and configuring it in the ApplicationPolicy with a different policy for each device. The managed configuration can contain a string property that you set to the device ID for each device.

您应用中的托管配置文件如下:

The managed configuration file in your app would look like:

<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"
      }
    }
  ]
}

此外,要在注册新设备后立即设置政策,您可以设置发布/订阅通知,并监听 ENROLLMENT 事件,通知的 data 字段包含具有设备ID的 Device 资源,因此,您可以创建新策略并将其分配给设备.

In addition, to set the policy as soon as a new device is enrolled you can set up Pub/Sub notifications and listen for ENROLLMENT events, the data field of the notification contains a Device resource with the device ID, therefore allowing you to create a new policy and assign it to the device.

这篇关于有什么方法可以从应用程序获取Android Management API设备ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆