QR code provisioning into Device Owner mode fails
Asked Answered
D

2

3

I have a device running Android 7.1.1 and I am building sample DPC app in preparation for making a COSU kiosk app but I keep running into an error in the provisioning setup.

Steps I take:

  1. Factory reset the device
  2. Successfully scan the code from the QR provisioning screen
  3. App downloads successfully and checksum check passes. I know this because at first it kept failing at wrongly generated checksum.
  4. Installing app message passes without error.
  5. The message changes to "Setting the device owner..." and immediately fails with the generic message "Oops! Couldn't set up your device..."

I've put simple Toast in DeviceAdminReceiver subclass into onEnabled and onProvisioningComplete functions. The Toast in onEnabled is displayed, the one in onProvisioningComplete is unsuprisingly not.

The app is signed with proper release certificate, setting the device owner through adb works fine as well which also leads me to belief that component name and manifest is ok otherwise adb command would fail as well.

QR code text:

{
  "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "component name",   
  "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM": "the checksum",
  "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "the link",
  "android.app.extra.PROVISIONING_SKIP_ENCRYPTION" : "True",
  "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED" : "True"
}

Any ideas what might be wrong ? I've run out of mine. Thanks for any input !

Devotion answered 20/11, 2018 at 14:22 Comment(0)
D
4
{
     "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "com.my.app/com.my.app.MyDeviceAdminReceiver",   
     "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM": "the checksum",
     "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "the link",
     "android.app.extra.PROVISIONING_SKIP_ENCRYPTION" : true,
     "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED" : true
}

values for PROVISIONING_SKIP_ENCRYPTION and PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED should be boolean, not strings. At least its boolean in my app and it works.

Also make sure you specified the component name of the device admin receiver in a proper way. the specified component must extend android.app.admin.DeviceAdminReceiver.

Deuced answered 23/11, 2018 at 6:59 Comment(2)
The bools did the trick. Thank you! At first I was testing without SKIP_ENCRYPTION and LEAVE_ALL_SYSTEM_APPS_ENABLED fields and it wasn't working anyway, curious.Devotion
I think you've missed a double-quote in front of com.my.app.... on the first line.Peristome
G
1
{
    "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME":"com.rrivenllc.shieldx/.receivers.DeviceAdmin",
    "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION":"https://shieldx.rrivenllc.com/shieldx_install.apk",
    "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM":"AvZj_u-zsxNDgiRJtDTy4lcH06MqE-1xIfqP8JWmsak",
    "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED":true
}
Gutow answered 27/6, 2022 at 15:39 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Curson

© 2022 - 2024 — McMap. All rights reserved.