DevicePolicyManager.TransferOwnership 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將現任管理員換成另一位。
[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) 。
若原始管理員仍為對應擁有者,則轉移失敗。
接收的目標管理員必須將 <support-transfer-ownership /> XML 檔案中<device-admin></device-admin>由 。DeviceAdminReceiver#DEVICE_ADMIN_META_DATA 否則 IllegalArgumentException 就會被丟棄。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。