Search code examples
androidandroid-management-api

How to get list of devices with Management API (beta)?


I'm essentially in the "Hello, World" phase of implementing Google's upcoming Android Management API (beta) for devices. I've gone through the Android Management API (beta) introduction and several guides and I'm stuck at the very basic step of enrolling a device. Following Google's Quickstart guide, and the general outline of the code embedded in the linked IPython Notebook, I've managed to:

  1. create a project,

  2. create an enterprise,

  3. create a policy,

  4. script the process of generating an enrollment token and displaying the resulting qrCode.

It's step 4 that appears to be the problem: I'm stuck in actually enrolling a device. Doing a factory reset of a 7.1 device, I'm six-times tapping on the welcome screen, and getting to the qrCode scan. That appears to work, and the device gives some indications that it is managed, but I am so far unable to see the device ID listed when I request all devices via method enterprises.devices.list. That API call returns 200 OK and an empty list:

[]

Even waiting 24 hours, that list is still empty.

I'm assuming that I've misconfigured something with the JSON/qrCode, but I'm currently at a loss as to what. Help please; through the linked Android Management API (beta), how do I properly list the enrolled devices?


Solution

  • Looks like this is a bug with the particular Android device with which I'm currently working: Lenovo Tab 4 10 X304F (2G, 32GB). We can utilize the manual workflow of afw#setup as the username, and then type (not QR scan) the 20 character code enrollment token and it works as expected, but any attempt to QR scan results in enrollment failure.

    For future web searchers, the actual failure presents as an "iZat" location consent prompt which interrupts the provisioning process. The provisioning process is apparently not robust, and can't be restarted or continued. The only recourse is to factory reset and go the manual code entry route. In short, a paperweight for our purposes.