1

I'm setting up Android Management API on Android 8.1.0 in fully managed mode, using a QR Code.

I'm following Google code lab link to provision a fully managed device, authenticate with my account then it works.

But when I authenticate with a service account, following sample code to generate a QR code then it doesn't work:

  1. The policies are not synchronized.
  2. enterprises.devices.list returns empty list.

But if I use that one to set up work profile mode then it works.

The service account has Owner role in Google Cloud Project.

This is QR code content:

// Authenticate with a Service Account
{
    "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "com.google.android.apps.work.clouddpc/.receivers.CloudDeviceAdminReceiver",
    "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM": "I5YvS0O5hXY46mb01BlRjq4oJJGs2kuUcHvVkAPEXlg",
    "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "https://play.google.com/managed/downloadManagingApp?identifier=setup",
    "android.app.extra.PROVISIONING_ADMIN_EXTRAS_BUNDLE": {
        "com.google.android.apps.work.clouddpc.EXTRA_ENROLLMENT_TOKEN": "MHBHXZQECHGARCKAKSHF"
    }
}

Do I have to configure something else for that Service Account?

I enabled Android Management API in the project.

  • When you say "then it doesn't work", can you explain/paste the error you get? Is the API call failing or is it the device setup? – Fred Nov 11 '19 at 18:26
  • Hi @Fred, I updated the question. It doesn't work means **the policies aren't synchronized**. – Hoang Le Anh Tu Nov 12 '19 at 23:34
  • The sample code creates a new enterprise and policies are not shared between enterprises. Did you try setting the `enterpriseName` in the sample code to the name of the enterprise you created in the notebook? – Fred Nov 13 '19 at 12:33
  • Hi @Fred. Yes, I did, commented `createEnterprise()`, but I cannot use QR Code generated by sample code to provision as fully managed device. I can only use that one to provision work profile. – Hoang Le Anh Tu Nov 14 '19 at 03:11

1 Answers1

0

Step 1: Create a policy Step 2: Create an enrolment token Step 3: Use QR to enrol your device by tapping 6 times

Try creating an enrolment token using the API mentioned below and make sure to specify a default policy for enrolment.

https://developers.google.com/android/management/reference/rest/v1/enterprises.enrollmentTokens/create

Zubair Rehman
  • 2,335
  • 2
  • 20
  • 25