Context.BindServiceAsUser Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| BindServiceAsUser(Intent, IServiceConnection, Context+BindServiceFlags, UserHandle) |
See Context.BindServiceAsUser(Intent, IServiceConnection, int, UserHandle). Call Context.BindServiceFlags.Of(long) to obtain a BindServiceFlags object. |
| BindServiceAsUser(Intent, IServiceConnection, Int32, UserHandle) |
Binds to a service in the given |
BindServiceAsUser(Intent, IServiceConnection, Context+BindServiceFlags, UserHandle)
See Context.BindServiceAsUser(Intent, IServiceConnection, int, UserHandle). Call Context.BindServiceFlags.Of(long) to obtain a BindServiceFlags object.
[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
This value cannot be null .
- conn
- IServiceConnection
This value cannot be null .
- flags
- Context.BindServiceFlags
This value cannot be null .
- user
- UserHandle
This value cannot be null .
Returns
See Context.BindServiceAsUser(Intent, IServiceConnection, int, UserHandle). Call Context.BindServiceFlags.Of(long) to obtain a BindServiceFlags object.
- Attributes
Remarks
See Context.BindServiceAsUser(Intent, IServiceConnection, int, UserHandle). Call Context.BindServiceFlags.Of(long) to obtain a BindServiceFlags object.
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
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, AutoCreate, DebugUnbind, NotForeground, AboveClient, AllowOomManagement, WaivePriority. Important, or AdjustWithActivity.
- user
- UserHandle
This value cannot be null .
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(IServiceConnection)
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:
- caller has
android.Manifest.permission.INTERACT_ACROSS_USERS_FULL - caller has
android.Manifest.permission.INTERACT_ACROSS_USERSand is the same package as theservice(determined by its component's package) and the Android version is at least Tiramisu - caller has
android.Manifest.permission.INTERACT_ACROSS_USERSand is in same profile group as the givenuser - caller has
android.Manifest.permission.INTERACT_ACROSS_PROFILESand is in same profile group as the givenuserand is the same package as theservice
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.