12

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

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

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

2
  • 2
    I'm not sure you can fetch the device id directly from your Kiosk app. But you could create a Managed Configuration for you Kiosk app, then push the device id through it. Commented Mar 19, 2019 at 14:56
  • 1
    I would also recommend using managed configurations, I added a more detailed answer below to explain it. Commented Mar 19, 2019 at 22:52

1 Answer 1

7

It is not possible for your app to directly access the device 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> 

And the policy would look like:

{ "applications": [ { "packageName": "com.example", "installType": "FORCE_INSTALLED", "managedConfiguration": { "deviceId": "1a2b3c4d5e6f" } } ] } 

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.

Sign up to request clarification or add additional context in comments.

6 Comments

While this approach works, it's a bit cumbersome. Is there any way to use Android Management API and have a custom developed app with permission to retrieve more information about the device, enterprise etc from the DPC?
@Hameno Did you find out if it is possible to retrieve the extra information (e.g. device, enterprise) from the Android app?
Do you guys able to get the details form the android app?
This is very limiting, isn't it? If a certain policy-change should be applied to X devices, then X policies should be patched (rather than just 1). Is there a way to get around that?
This is unnecessarily complex. It is very basic thing that we need. If I need to remove policy from one user how will I know that users device. There should be an easy way management api team.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.