語言

DevicePolicyManager.TransferOwnership 方法

定義

將現任管理員換成另一位。

[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

參數

admin
ComponentName

這個請求就是與此 DeviceAdminReceiver 相關聯的。

target
ComponentName

我們希望新任管理員能擔任。DeviceAdminReceiver

bundle
PersistableBundle

資料將傳送給新管理員。

屬性

備註

將現任管理員換成另一位。 目前管理員的所有政策都會轉移到新管理員。 整個操作是原子式的——傳輸要麼完成,要麼根本不完成。

根據目前的管理員(裝置擁有者、設定檔擁有者),你預期會有以下行為: <ul><li>裝置擁有者只能轉移給新的裝置擁有者</li><li>設定檔擁有者只能轉移給新的設定檔案擁有者</li></ul>

利用參數 bundle 將資料傳給新的管理員。 資料會在新管理員的回電中收到 DeviceAdminReceiver#onTransferOwnershipComplete(Context, PersistableBundle) 。

若原始管理員仍為對應擁有者,則轉移失敗。

接收的目標管理員必須將 &lt;support-transfer-ownership /&gt; XML 檔案中&lt;device-admin&gt;&lt;/device-admin&gt;由 。DeviceAdminReceiver#DEVICE_ADMIN_META_DATA 否則 IllegalArgumentException 就會被丟棄。

Java 文件 android.app.admin.DevicePolicyManager.transferOwnership(android.content.ComponentName, android.content.ComponentName, android.os.PersistableBundle)。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於