Megosztás a következőn keresztül:


Context.BindServiceAsUser Method

Definition

Overloads

BindServiceAsUser(Intent, IServiceConnection, Context+BindServiceFlags, UserHandle)
BindServiceAsUser(Intent, IServiceConnection, Int32, UserHandle)

Binds to a service in the given user in the same manner as #bindService.

BindServiceAsUser(Intent, IServiceConnection, Context+BindServiceFlags, UserHandle)

[Android.Runtime.Register("bindServiceAsUser", "(Landroid/content/Intent;Landroid/content/ServiceConnection;Landroid/content/Context$BindServiceFlags;Landroid/os/UserHandle;)Z", "GetBindServiceAsUser_Landroid_content_Intent_Landroid_content_ServiceConnection_Landroid_content_Context_BindServiceFlags_Landroid_os_UserHandle_Handler", ApiSince=34)]
public virtual bool BindServiceAsUser (Android.Content.Intent service, Android.Content.IServiceConnection conn, Android.Content.Context.BindServiceFlags flags, Android.OS.UserHandle user);
[<Android.Runtime.Register("bindServiceAsUser", "(Landroid/content/Intent;Landroid/content/ServiceConnection;Landroid/content/Context$BindServiceFlags;Landroid/os/UserHandle;)Z", "GetBindServiceAsUser_Landroid_content_Intent_Landroid_content_ServiceConnection_Landroid_content_Context_BindServiceFlags_Landroid_os_UserHandle_Handler", ApiSince=34)>]
abstract member BindServiceAsUser : Android.Content.Intent * Android.Content.IServiceConnection * Android.Content.Context.BindServiceFlags * Android.OS.UserHandle -> bool
override this.BindServiceAsUser : Android.Content.Intent * Android.Content.IServiceConnection * Android.Content.Context.BindServiceFlags * Android.OS.UserHandle -> bool

Parameters

service
Intent
user
UserHandle

Returns

Attributes

Applies to

BindServiceAsUser(Intent, IServiceConnection, Int32, UserHandle)

Binds to a service in the given user in the same manner as #bindService.

[Android.Runtime.Register("bindServiceAsUser", "(Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/UserHandle;)Z", "GetBindServiceAsUser_Landroid_content_Intent_Landroid_content_ServiceConnection_ILandroid_os_UserHandle_Handler", ApiSince=30)]
public virtual bool BindServiceAsUser (Android.Content.Intent service, Android.Content.IServiceConnection conn, int flags, Android.OS.UserHandle user);
[<Android.Runtime.Register("bindServiceAsUser", "(Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/UserHandle;)Z", "GetBindServiceAsUser_Landroid_content_Intent_Landroid_content_ServiceConnection_ILandroid_os_UserHandle_Handler", ApiSince=30)>]
abstract member BindServiceAsUser : Android.Content.Intent * Android.Content.IServiceConnection * int * Android.OS.UserHandle -> bool
override this.BindServiceAsUser : Android.Content.Intent * Android.Content.IServiceConnection * int * Android.OS.UserHandle -> bool

Parameters

service
Intent

Identifies the service to connect to. The Intent must specify an explicit component name.

conn
IServiceConnection

Receives information as the service is started and stopped. This must be a valid ServiceConnection object; it must not be null.

flags
Int32

Operation options for the binding. May be 0, #BIND_AUTO_CREATE, #BIND_DEBUG_UNBIND, #BIND_NOT_FOREGROUND, #BIND_ABOVE_CLIENT, #BIND_ALLOW_OOM_MANAGEMENT, #BIND_WAIVE_PRIORITY. #BIND_IMPORTANT, or #BIND_ADJUST_WITH_ACTIVITY.

user
UserHandle

Returns

true if the system is in the process of bringing up a service that your client has permission to bind to; false if the system couldn't find the service. You should call #unbindService to release the connection even if this method returned false.

Attributes

Remarks

Binds to a service in the given user in the same manner as #bindService.

Requires that one of the following conditions are met: <ul> <li>caller has android.Manifest.permission.INTERACT_ACROSS_USERS_FULL</li> <li>caller has android.Manifest.permission.INTERACT_ACROSS_USERS and is the same package as the service (determined by its component's package) and the Android version is at least android.os.Build.VERSION_CODES#TIRAMISU</li> <li>caller has android.Manifest.permission.INTERACT_ACROSS_USERS and is in same profile group as the given user</li> <li>caller has android.Manifest.permission.INTERACT_ACROSS_PROFILES and is in same profile group as the given user and is the same package as the service</li> </ul>

Java documentation for android.content.Context.bindServiceAsUser(android.content.Intent, android.content.ServiceConnection, int, android.os.UserHandle).

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.

Applies to