语言

DevicePolicyManager.BindDeviceAdminServiceAsUser 方法

定义

重载

名称 说明
BindDeviceAdminServiceAsUser(ComponentName, Intent, IServiceConnection, Bind, UserHandle)

由设备所有者调用,以从辅助托管用户绑定到服务,反之亦然。

BindDeviceAdminServiceAsUser(ComponentName, Intent, IServiceConnection, Context+BindServiceFlags, UserHandle)

请参阅 bindDeviceAdminServiceAsUser(ComponentName,Intent,ServiceConnection,int,UserHandle)。

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的用户之一,否则将引发 a SecurityException 。

返回

如果已成功绑定到服务, true 则返回; false 如果未建立连接,并且不会收到服务对象,则返回该连接。

特性

注解

由设备所有者调用,以从辅助托管用户绑定到服务,反之亦然。 请参阅 #getBindDeviceAdminTargetUsers 设备所有者绑定到另一个托管用户的服务的先决条件。

服务必须受到 android.Manifest.permission#BIND_DEVICE_ADMIN保护。 请注意,Context用于获取DevicePolicyManager此Context#getSystemService(Class)实例的用法将用于绑定到该android.app.Service实例。

注意:此方法用于在设备所有者和配置文件所有者之间进行通信。 但是,由于 Android 11,这种组合是不可能的。 此方法现在仅适用于设备所有者与托管辅助用户之间的通信。

Java文档android.app.admin.DevicePolicyManager.bindDeviceAdminServiceAsUser(android.content.ComponentName, android.content.Intent, android.content.ServiceConnection, int, android.os.UserHandle)。

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于

BindDeviceAdminServiceAsUser(ComponentName, Intent, IServiceConnection, Context+BindServiceFlags, UserHandle)

请参阅 bindDeviceAdminServiceAsUser(ComponentName,Intent,ServiceConnection,int,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

参数

serviceIntent
Intent
targetUser
UserHandle

返回

特性

注解

请参阅 bindDeviceAdminServiceAsUser(ComponentName,Intent,ServiceConnection,int,UserHandle)。 调用 Context.BindServiceFlags.of(long)以获取 BindServiceFlags 对象。

Android 参考。android.app.admin.DevicePolicyManager.bindDeviceAdminServiceAsUser

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于