Partager via


DeviceAdminReceiver Class

Definition

Base class for implementing a device administration component.

[Android.Runtime.Register("android/app/admin/DeviceAdminReceiver", DoNotGenerateAcw=true)]
public class DeviceAdminReceiver : Android.Content.BroadcastReceiver
[<Android.Runtime.Register("android/app/admin/DeviceAdminReceiver", DoNotGenerateAcw=true)>]
type DeviceAdminReceiver = class
    inherit BroadcastReceiver
Inheritance
DeviceAdminReceiver
Attributes

Remarks

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(Context, Intent) 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:

{

Java documentation for android.app.admin.DeviceAdminReceiver.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

DeviceAdminReceiver()
DeviceAdminReceiver(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Fields

ActionChoosePrivateKeyAlias

Broadcast action: notify that some app is attempting to choose a KeyChain key.

ActionDeviceAdminDisabled

Action sent to a device administrator when the user has disabled it.

ActionDeviceAdminDisableRequested

Action sent to a device administrator when the user has requested to disable it, but before this has actually been done.

ActionDeviceAdminEnabled

This is the primary action that a device administrator must implement to be allowed to manage a device.

ActionLockTaskEntering

Action sent to a device administrator to notify that the device is entering lock task mode.

ActionLockTaskExiting

Action sent to a device administrator to notify that the device is exiting lock task mode.

ActionNetworkLogsAvailable

Broadcast action: notify that a new batch of network logs is ready to be collected.

ActionPasswordChanged

Action sent to a device administrator when the user has changed the password of their device or profile challenge.

ActionPasswordExpiring

Action periodically sent to a device administrator when the device or profile challenge password is expiring.

ActionPasswordFailed

Action sent to a device administrator when the user has entered an incorrect device or profile challenge password.

ActionPasswordSucceeded

Action sent to a device administrator when the user has successfully entered their device or profile challenge password, after failing one or more times.

ActionProfileProvisioningComplete

Broadcast Action: This broadcast is sent to indicate that provisioning of a managed profile or managed device has completed successfully.

ActionSecurityLogsAvailable

Broadcast action: notify that a new batch of security logs is ready to be collected.

BugreportFailureFailedCompleting
Obsolete.

Bugreport completion process failed.

BugreportFailureFileNoLongerAvailable
Obsolete.

Bugreport has been created, but is no longer available for collection.

DeviceAdminMetaData

Name under which a DevicePolicy component publishes information about itself.

ExtraDisableWarning

A CharSequence that can be shown to the user informing them of the impact of disabling your admin.

ExtraLockTaskPackage

A string containing the name of the package entering lock task mode.

ExtraTransferOwnershipAdminExtrasBundle

A android.os.Parcelable extra of type android.os.PersistableBundle that allows a mobile device management application to pass data to the management application instance after owner transfer.

Properties

AbortBroadcast

Returns the flag indicating whether or not this receiver should abort the current broadcast.

(Inherited from BroadcastReceiver)
Class

Returns the runtime class of this Object.

(Inherited from Object)
DebugUnregister

Return the last value given to #setDebugUnregister. -or- Control inclusion of debugging help for mismatched calls to Context#registerReceiver(BroadcastReceiver, IntentFilter) Context.registerReceiver().

(Inherited from BroadcastReceiver)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsInitialStickyBroadcast

Returns true if the receiver is currently processing the initial value of a sticky broadcast -- that is, the value that was last broadcast and is currently held in the sticky cache, so this is not directly the result of a broadcast right now.

(Inherited from BroadcastReceiver)
IsOrderedBroadcast

Returns true if the receiver is currently processing an ordered broadcast.

(Inherited from BroadcastReceiver)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ResultCode

Retrieve the current result code, as set by the previous receiver. -or- Change the current result code of this broadcast; only works with broadcasts sent through Context#sendOrderedBroadcast(Intent, String) Context.sendOrderedBroadcast.

(Inherited from BroadcastReceiver)
ResultData

Retrieve the current result data, as set by the previous receiver. -or- Change the current result data of this broadcast; only works with broadcasts sent through Context#sendOrderedBroadcast(Intent, String) Context.sendOrderedBroadcast.

(Inherited from BroadcastReceiver)
SentFromPackage

Returns the package name of the app that initially sent this broadcast.

(Inherited from BroadcastReceiver)
SentFromUid

Returns the uid of the app that initially sent this broadcast.

(Inherited from BroadcastReceiver)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

ClearAbortBroadcast()

Clears the flag indicating that this receiver should abort the current broadcast.

(Inherited from BroadcastReceiver)
Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetManager(Context)

Retrieve the DevicePolicyManager interface for this administrator to work with the system.

GetResultExtras(Boolean)

Retrieve the current result extra data, as set by the previous receiver.

(Inherited from BroadcastReceiver)
GetWho(Context)

Retrieve the ComponentName describing who this device administrator is, for use in DevicePolicyManager APIs that require the administrator to identify itself.

GoAsync()

This can be called by an application in #onReceive to allow it to keep the broadcast active after returning from that function.

(Inherited from BroadcastReceiver)
InvokeAbortBroadcast()

Sets the flag indicating that this receiver should abort the current broadcast; only works with broadcasts sent through Context#sendOrderedBroadcast(Intent, String) Context.sendOrderedBroadcast.

(Inherited from BroadcastReceiver)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
OnBugreportFailed(Context, Intent, BugReportFailureReason)

Called when the bugreport collection flow has failed.

OnBugreportShared(Context, Intent, String)

Called when the bugreport has been shared with the device administrator app.

OnBugreportSharingDeclined(Context, Intent)

Called when sharing a bugreport has been cancelled by the user of the device.

OnChoosePrivateKeyAlias(Context, Intent, Int32, Uri, String)

Allows this receiver to select the alias for a private key and certificate pair for authentication.

OnComplianceAcknowledgementRequired(Context, 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.

OnDisabled(Context, Intent)

Called prior to the administrator being disabled, as a result of receiving #ACTION_DEVICE_ADMIN_DISABLED.

OnDisableRequested(Context, Intent)

Called when the user has asked to disable the administrator, as a result of receiving #ACTION_DEVICE_ADMIN_DISABLE_REQUESTED, giving you a chance to present a warning message to them.

OnDisableRequestedFormatted(Context, Intent)

Called when the user has asked to disable the administrator, as a result of receiving #ACTION_DEVICE_ADMIN_DISABLE_REQUESTED, giving you a chance to present a warning message to them.

OnEnabled(Context, Intent)

Called after the administrator is first enabled, as a result of receiving #ACTION_DEVICE_ADMIN_ENABLED.

OnLockTaskModeEntering(Context, Intent, String)

Called when a device is entering lock task mode.

OnLockTaskModeExiting(Context, Intent)

Called when a device is exiting lock task mode.

OnNetworkLogsAvailable(Context, Intent, Int64, Int32)

Called each time a new batch of network logs can be retrieved.

OnOperationSafetyStateChanged(Context, Int32, Boolean)

Called to notify the state of operations that can be unsafe to execute has changed.

OnPasswordChanged(Context, Intent, UserHandle)

Called after the user has changed their device or profile challenge password, as a result of receiving #ACTION_PASSWORD_CHANGED.

OnPasswordChanged(Context, Intent)

Called after the user has changed their device or profile challenge password, as a result of receiving #ACTION_PASSWORD_CHANGED.

OnPasswordExpiring(Context, Intent, UserHandle)

Called periodically when the device or profile challenge password is about to expire or has expired.

OnPasswordExpiring(Context, Intent)

Called periodically when the device or profile challenge password is about to expire or has expired.

OnPasswordFailed(Context, Intent, UserHandle)

Called after the user has failed at entering their device or profile challenge password, as a result of receiving #ACTION_PASSWORD_FAILED.

OnPasswordFailed(Context, Intent)

Called after the user has failed at entering their device or profile challenge password, as a result of receiving #ACTION_PASSWORD_FAILED.

OnPasswordSucceeded(Context, Intent, UserHandle)

Called after the user has succeeded at entering their device or profile challenge password, as a result of receiving #ACTION_PASSWORD_SUCCEEDED.

OnPasswordSucceeded(Context, Intent)

Called after the user has succeeded at entering their device or profile challenge password, as a result of receiving #ACTION_PASSWORD_SUCCEEDED.

OnProfileProvisioningComplete(Context, Intent)

Called when provisioning of a managed profile or managed device has completed successfully.

OnReadyForUserInitialization(Context, Intent)

Called during provisioning of a managed device to allow the device initializer to perform user setup steps.

OnReceive(Context, Intent)

Intercept standard device administrator broadcasts.

OnSecurityLogsAvailable(Context, Intent)

Called when a new batch of security logs can be retrieved.

OnSystemUpdatePending(Context, Intent, Int64)

Called when the information about a pending system update is available.

OnTransferAffiliatedProfileOwnershipComplete(Context, UserHandle)

Called on the device owner when the ownership of one of its affiliated profiles is transferred.

OnTransferOwnershipComplete(Context, PersistableBundle)

Called on the newly assigned owner (either device owner or profile owner) when the ownership transfer has completed successfully.

OnUserAdded(Context, Intent, UserHandle)

Called when a user or profile is created.

OnUserRemoved(Context, Intent, UserHandle)

Called when a user or profile is removed.

OnUserStarted(Context, Intent, UserHandle)

Called when a user or profile is started.

OnUserStopped(Context, Intent, UserHandle)

Called when a user or profile is stopped.

OnUserSwitched(Context, Intent, UserHandle)

Called when a user or profile is switched to.

PeekService(Context, Intent)

Provide a binder to an already-bound service.

(Inherited from BroadcastReceiver)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetOrderedHint(Boolean)

For internal use, sets the hint about whether this BroadcastReceiver is running in ordered mode.

(Inherited from BroadcastReceiver)
SetResult(Result, String, Bundle)

Change all of the result data returned from this broadcasts; only works with broadcasts sent through Context#sendOrderedBroadcast(Intent, String) Context.sendOrderedBroadcast.

(Inherited from BroadcastReceiver)
SetResultExtras(Bundle)

Change the current result extras of this broadcast; only works with broadcasts sent through Context#sendOrderedBroadcast(Intent, String) Context.sendOrderedBroadcast.

(Inherited from BroadcastReceiver)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to