How to enable task locking in Android 5.0 production devices

我只是一个虾纸丫 提交于 2019-12-11 04:43:58

问题


I have an app for my company(Enterprise) owned devices , which works as single use app, so it locks itself and becomes single use app, for that it needs to be enabled as device owner, for testing i am using adb shell command and it works.

my problem is how do i achieve it for production so my enterprise will be able to install and use this as required.


回答1:


This answer will work if your Android 5.0 devices have NFC. Otherwise, Google supported a method using a Google Account with an activiation code within the Google Setup Wizard, but you need to be a Google EMM partner. I also don't know if they still support activation codes in 5.0/5.1. It was a Lollipop specific implementation.


If your devices DON'T have NFC, this link might help you set the device-owner programmatically, but it's not a recommended solution for production apps: How to make my app device owner without NFC and ADB shell command


But finally, if your devices DO have NFC:

You will need a provisioning wifi network that can connect to a server hosting the app that will be the device owner.

You can modify this project to create a quick provisioning app: https://github.com/googlesamples/android-NfcProvisioning

Be sure the NFC provisioning app sends, at a minimum, this information over NFC for an Android 5.0 device:

  • EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME
  • EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM
  • EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION
  • EXTRA_PROVISIONING_LOCALE
  • EXTRA_PROVISIONING_TIME_ZONE
  • EXTRA_PROVISIONING_WIFI_SSID
  • EXTRA_PROVISIONING_WIFI_SECURITY_TYPE
  • EXTRA_PROVISIONING_WIFI_PASSWORD

When your corporate owned device is at the welcome screen of the Google Setup Wizard, place this device back-to-back with the provisioner device with the NFC provisioning app running. You will then tap the NFC provisioning app when it senses another NFC device. This sends across all the information the Google Setup Wizard requires to get on the network, download the app, verify the app, and then installs the app as the device owner.

Here's a good reference for creating package checksum: Checksum Error while provisioning Android Lollipop



来源:https://stackoverflow.com/questions/46727461/how-to-enable-task-locking-in-android-5-0-production-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!