DevicePolicyManager.BindDeviceAdminServiceAsUser 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
BindDeviceAdminServiceAsUser(ComponentName, Intent, IServiceConnection, Bind, UserHandle)
裝置擁有者呼叫以綁定次要受管理使用者的服務,或反之亦然。
[Android.Runtime.Register("bindDeviceAdminServiceAsUser", "(Landroid/content/ComponentName;Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/UserHandle;)Z", "GetBindDeviceAdminServiceAsUser_Landroid_content_ComponentName_Landroid_content_Intent_Landroid_content_ServiceConnection_ILandroid_os_UserHandle_Handler", ApiSince=26)]
public virtual bool BindDeviceAdminServiceAsUser(Android.Content.ComponentName admin, Android.Content.Intent serviceIntent, Android.Content.IServiceConnection conn, Android.Content.Bind flags, Android.OS.UserHandle targetUser);
[<Android.Runtime.Register("bindDeviceAdminServiceAsUser", "(Landroid/content/ComponentName;Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/UserHandle;)Z", "GetBindDeviceAdminServiceAsUser_Landroid_content_ComponentName_Landroid_content_Intent_Landroid_content_ServiceConnection_ILandroid_os_UserHandle_Handler", ApiSince=26)>]
abstract member BindDeviceAdminServiceAsUser : Android.Content.ComponentName * Android.Content.Intent * Android.Content.IServiceConnection * Android.Content.Bind * Android.OS.UserHandle -> bool
override this.BindDeviceAdminServiceAsUser : Android.Content.ComponentName * Android.Content.Intent * Android.Content.IServiceConnection * Android.Content.Bind * Android.OS.UserHandle -> bool
參數
- admin
- ComponentName
這個請求就是和這個 DeviceAdminReceiver 問題有關的。
- serviceIntent
- Intent
識別要連接的服務。 意圖必須指定明確的元件名稱或套件名稱,以符合 IntentFilter 服務發佈的名稱。
- conn
- IServiceConnection
在主執行緒中,服務啟動與停止時接收資訊。 這必須是有效 ServiceConnection 物件;它不能是 null。
- flags
- Bind
綁定操作的操作選項。 參見 Context#bindService(Intent, ServiceConnection, int)。
- targetUser
- UserHandle
要綁定哪個使用者。 必須是被 #getBindDeviceAdminTargetUsers返回的使用者之一,否則 SecurityException 會被丟棄。
傳回
如果你成功綁定到服務,則 true 會被回傳; false 如果沒有建立連結,且你不會收到該服務物件,則會被回傳。
- 屬性
備註
裝置擁有者呼叫以綁定次要受管理使用者的服務,或反之亦然。 請參閱 #getBindDeviceAdminTargetUsers 裝置擁有者綁定至其他受管理使用者服務的先決條件。
服務必須受到 android.Manifest.permission#BIND_DEVICE_ADMIN保護。 請注意Context,用來透過 取得此DevicePolicyManager實例Context#getSystemService(Class)的 將被用來綁定 。android.app.Service
注意:此方法過去可用於裝置擁有者與設定檔擁有者之間的通訊。 然而,自 Android 11 起,這種組合已無法實現。 此方法現僅適用於裝置擁有者與受管理次級使用者之間的通訊。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
適用於
BindDeviceAdminServiceAsUser(ComponentName, Intent, IServiceConnection, Context+BindServiceFlags, UserHandle)
[Android.Runtime.Register("bindDeviceAdminServiceAsUser", "(Landroid/content/ComponentName;Landroid/content/Intent;Landroid/content/ServiceConnection;Landroid/content/Context$BindServiceFlags;Landroid/os/UserHandle;)Z", "GetBindDeviceAdminServiceAsUser_Landroid_content_ComponentName_Landroid_content_Intent_Landroid_content_ServiceConnection_Landroid_content_Context_BindServiceFlags_Landroid_os_UserHandle_Handler", ApiSince=34)]
public virtual bool BindDeviceAdminServiceAsUser(Android.Content.ComponentName admin, Android.Content.Intent serviceIntent, Android.Content.IServiceConnection conn, Android.Content.Context.BindServiceFlags flags, Android.OS.UserHandle targetUser);
[<Android.Runtime.Register("bindDeviceAdminServiceAsUser", "(Landroid/content/ComponentName;Landroid/content/Intent;Landroid/content/ServiceConnection;Landroid/content/Context$BindServiceFlags;Landroid/os/UserHandle;)Z", "GetBindDeviceAdminServiceAsUser_Landroid_content_ComponentName_Landroid_content_Intent_Landroid_content_ServiceConnection_Landroid_content_Context_BindServiceFlags_Landroid_os_UserHandle_Handler", ApiSince=34)>]
abstract member BindDeviceAdminServiceAsUser : Android.Content.ComponentName * Android.Content.Intent * Android.Content.IServiceConnection * Android.Content.Context.BindServiceFlags * Android.OS.UserHandle -> bool
override this.BindDeviceAdminServiceAsUser : Android.Content.ComponentName * Android.Content.Intent * Android.Content.IServiceConnection * Android.Content.Context.BindServiceFlags * Android.OS.UserHandle -> bool
參數
- admin
- ComponentName
- serviceIntent
- Intent
- conn
- IServiceConnection
- flags
- Context.BindServiceFlags
- targetUser
- UserHandle
傳回
- 屬性