DeviceAdminReceiver
open class DeviceAdminReceiver : BroadcastReceiver
| kotlin.Any | ||
| ↳ | android.content.BroadcastReceiver | |
| ↳ | android.app.admin.DeviceAdminReceiver | |
Base class for implementing a device administration component. This class provides a convenience for interpreting the raw intent actions that are sent by the system.
The callback methods, like the base BroadcastReceiver.onReceive() method, happen on the main thread of the process. Thus long running operations must be done on another thread. Note that because a receiver is done once returning from its receive function, such long-running operations should probably be done in a Service.
When publishing your DeviceAdmin subclass as a receiver, it must handle ACTION_DEVICE_ADMIN_ENABLED and require the android.Manifest.permission#BIND_DEVICE_ADMIN permission. A typical manifest entry would look like:
The meta-data referenced here provides addition information specific to the device administrator, as parsed by the DeviceAdminInfo class. A typical file would be:
Summary
| Constants | |
|---|---|
| static String |
Broadcast action: notify that some app is attempting to choose a KeyChain key. |
| static String |
Action sent to a device administrator when the user has disabled it. |
| static String |
Action sent to a device administrator when the user has requested to disable it, but before this has actually been done. |
| static String |
This is the primary action that a device administrator must implement to be allowed to manage a device. |
| static String |
Action sent to a device administrator to notify that the device is entering lock task mode. |
| static String |
Action sent to a device administrator to notify that the device is exiting lock task mode. |
| static String |
Broadcast action: notify that a new batch of network logs is ready to be collected. |
| static String |
Action sent to a device administrator when the user has changed the password of their device or profile challenge. |
| static String |
Action periodically sent to a device administrator when the device or profile challenge password is expiring. |
| static String |
Action sent to a device administrator when the user has entered an incorrect device or profile challenge password. |
| static String |
Action sent to a device administrator when the user has successfully entered their device or profile challenge password, after failing one or more times. |
| static String |
Broadcast Action: This broadcast is sent to indicate that provisioning of a managed profile or managed device has completed successfully. |
| static String |
Broadcast action: notify that a new batch of security logs is ready to be collected. |
| static Int |
Bugreport completion process failed. |
| static Int |
Bugreport has been created, but is no longer available for collection. |
| static String |
Name under which a DevicePolicy component publishes information about itself. |
| static String |
A CharSequence that can be shown to the user informing them of the impact of disabling your admin. |
| static String |
A string containing the name of the package entering lock task mode. |
| static String |
A |
| Public constructors | |
|---|---|
| Public methods | |
|---|---|
| open DevicePolicyManager |
getManager(context: Context)Retrieve the DevicePolicyManager interface for this administrator to work with the system. |
| open ComponentName |
Retrieve the ComponentName describing who this device administrator is, for use in |
| open Unit |
onBugreportFailed(context: Context, intent: Intent, failureCode: Int)Called when the bugreport collection flow has failed. |
| open Unit |
onBugreportShared(: Context, : Intent, : String)Called when the bugreport has been shared with the device administrator app. |
| open Unit |
onBugreportSharingDeclined(context: Context, intent: Intent)Called when sharing a bugreport has been cancelled by the user of the device. |
| open String? |
Allows this receiver to select the alias for a private key and certificate pair for authentication. |
| open Unit |
onComplianceAcknowledgementRequired(context: Context, intent: Intent)Called to notify a profile owner of an organization-owned device that it needs to acknowledge device compliance to allow the user to turn the profile off if needed according to the maximum profile time off policy. |
| open CharSequence? |
onDisableRequested(context: Context, intent: Intent)Called when the user has asked to disable the administrator, as a result of receiving |
| open Unit |
onDisabled(context: Context, intent: Intent)Called prior to the administrator being disabled, as a result of receiving |
| open Unit |
Called after the administrator is first enabled, as a result of receiving |
| open Unit |
onLockTaskModeEntering(context: Context, intent: Intent, pkg: String)Called when a device is entering lock task mode. |
| open Unit |
onLockTaskModeExiting(context: Context, intent: Intent)Called when a device is exiting lock task mode. |
| open Unit |
onNetworkLogsAvailable(context: Context, intent: Intent, batchToken: Long, networkLogsCount: Int)Called each time a new batch of network logs can be retrieved. |
| open Unit |
onOperationSafetyStateChanged(context: Context, reason: Int, isSafe: Boolean)Called to notify the state of operations that can be unsafe to execute has changed. |
| open Unit |
onPasswordChanged(context: Context, intent: Intent)Called after the user has changed their device or profile challenge password, as a result of receiving |
| open Unit |
onPasswordChanged(context: Context, intent: Intent, user: UserHandle)Called after the user has changed their device or profile challenge password, as a result of receiving |
| open Unit |
onPasswordExpiring(context: Context, intent: Intent)Called periodically when the device or profile challenge password is about to expire or has expired. |
| open Unit |
onPasswordExpiring(context: Context, intent: Intent, user: UserHandle)Called periodically when the device or profile challenge password is about to expire or has expired. |
| open Unit |
onPasswordFailed(context: Context, intent: Intent)Called after the user has failed at entering their device or profile challenge password, as a result of receiving |
| open Unit |
onPasswordFailed(context: Context, intent: Intent, user: UserHandle)Called after the user has failed at entering their device or profile challenge password, as a result of receiving |
| open Unit |
onPasswordSucceeded(context: Context, intent: Intent)Called after the user has succeeded at entering their device or profile challenge password, as a result of receiving |
| open Unit |
onPasswordSucceeded(context: Context, intent: Intent, user: UserHandle)Called after the user has succeeded at entering their device or profile challenge password, as a result of receiving |
| open Unit |
onProfileProvisioningComplete(context: Context, intent: Intent)Called when provisioning of a managed profile or managed device has completed successfully. |
| open Unit |
onReadyForUserInitialization(context: Context, intent: Intent)Called during provisioning of a managed device to allow the device initializer to perform user setup steps. |
| open Unit |
Intercept standard device administrator broadcasts. |
| open Unit |
onSecurityLogsAvailable(context: Context, intent: Intent)Called when a new batch of security logs can be retrieved. |
| open Unit |
onSystemUpdatePending(context: Context, intent: Intent, receivedTime: Long)Called when the information about a pending system update is available. |
| open Unit |
onTransferAffiliatedProfileOwnershipComplete(context: Context, user: UserHandle)Called on the device owner when the ownership of one of its affiliated profiles is transferred. |
| open Unit |
onTransferOwnershipComplete(context: Context, bundle: PersistableBundle?)Called on the newly assigned owner (either device owner or profile owner) when the ownership transfer has completed successfully. |
| open Unit |
onUserAdded(context: Context, intent: Intent, addedUser: UserHandle)Called when a user or profile is created. |
| open Unit |
onUserRemoved(context: Context, intent: Intent, removedUser: UserHandle)Called when a user or profile is removed. |
| open Unit |
onUserStarted(context: Context, intent: Intent, startedUser: UserHandle)Called when a user or profile is started. |
| open Unit |
onUserStopped(context: Context, intent: Intent, stoppedUser: UserHandle)Called when a user or profile is stopped. |
| open Unit |
onUserSwitched(context: Context, intent: Intent, switchedUser: UserHandle)Called when a user or profile is switched to. |
| Inherited functions | |
|---|---|