DevicePolicyManager.TransferOwnership Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Changes the current administrator to another one.
[Android.Runtime.Register("transferOwnership", "(Landroid/content/ComponentName;Landroid/content/ComponentName;Landroid/os/PersistableBundle;)V", "GetTransferOwnership_Landroid_content_ComponentName_Landroid_content_ComponentName_Landroid_os_PersistableBundle_Handler", ApiSince=28)]
public virtual void TransferOwnership (Android.Content.ComponentName admin, Android.Content.ComponentName target, Android.OS.PersistableBundle? bundle);
[<Android.Runtime.Register("transferOwnership", "(Landroid/content/ComponentName;Landroid/content/ComponentName;Landroid/os/PersistableBundle;)V", "GetTransferOwnership_Landroid_content_ComponentName_Landroid_content_ComponentName_Landroid_os_PersistableBundle_Handler", ApiSince=28)>]
abstract member TransferOwnership : Android.Content.ComponentName * Android.Content.ComponentName * Android.OS.PersistableBundle -> unit
override this.TransferOwnership : Android.Content.ComponentName * Android.Content.ComponentName * Android.OS.PersistableBundle -> unit
Parameters
- admin
- ComponentName
which DeviceAdminReceiver
this request is associated with.
- target
- ComponentName
which DeviceAdminReceiver
we want the new administrator to be.
- bundle
- PersistableBundle
data to be sent to the new administrator.
- Attributes
Remarks
Changes the current administrator to another one. All policies from the current administrator are migrated to the new administrator. The whole operation is atomic - the transfer is either complete or not done at all.
Depending on the current administrator (device owner, profile owner), you have the following expected behaviour: <ul> <li>A device owner can only be transferred to a new device owner</li> <li>A profile owner can only be transferred to a new profile owner</li> </ul>
Use the bundle
parameter to pass data to the new administrator. The data will be received in the DeviceAdminReceiver#onTransferOwnershipComplete(Context, PersistableBundle)
callback of the new administrator.
The transfer has failed if the original administrator is still the corresponding owner after calling this method.
The incoming target administrator must have the <support-transfer-ownership />
tag inside the <device-admin></device-admin>
tags in the xml file referenced by DeviceAdminReceiver#DEVICE_ADMIN_META_DATA
. Otherwise an IllegalArgumentException
will be thrown.
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.