im trying to get the custom property from ANDMIN_EXTRAS_BUNDLE to be able to do different things accord to this parameter "company_name" but i can´t. i tried to get in in a "PROFILE_PROVISIONING_COMPLETE" receiver but it din´t work
class ProfileProvisioningCompleteReceiver: BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
Log.d("PROFILE PROVISIONING", "onReceive " + intent!!.action)
if (ACTION_PROFILE_PROVISIONING_COMPLETE == intent.action) {
val extras: PersistableBundle? = intent.getParcelableExtra(EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE)
Toast.makeText(context, "onReceive Extras:" + extras!!.getString("company_name"), Toast.LENGTH_LONG).show()
}
}
}
also i tried to put this same code in two different activities with intents "ADMIN_POLICY_COMPLIANCE" and "GET_PROVISIONING_MODE" as the doc says
my QR json looks like
{ "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "myAdminReceiver", "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM": "123asddf", "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "download/url", "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED": true, "android.app.extra.PROVISIONING_ADMIN_EXTRAS_BUNDLE": { "company_name": "my company" } }
any help would be appreciate
use onProfileProvisioningComplete() method in your DeviceAdminReceiver class.
this method trigger after success provision complete with Qr or Nfc
like this:
and in manifest file:
remember dont remove super in onProfileProvisioningComplete method