Context.BindIsolatedService 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 |
|---|---|
| BindIsolatedService(Intent, Context+BindServiceFlags, String, IExecutor, IServiceConnection) |
See bindIsolatedService(Intent,int,String,Executor,ServiceConnection) Call BindServiceFlags.of(long) to obtain a BindServiceFlags object. |
| BindIsolatedService(Intent, Int32, String, IExecutor, IServiceConnection) |
Variation of |
BindIsolatedService(Intent, Context+BindServiceFlags, String, IExecutor, IServiceConnection)
See bindIsolatedService(Intent,int,String,Executor,ServiceConnection) Call BindServiceFlags.of(long) to obtain a BindServiceFlags object.
[Android.Runtime.Register("bindIsolatedService", "(Landroid/content/Intent;Landroid/content/Context$BindServiceFlags;Ljava/lang/String;Ljava/util/concurrent/Executor;Landroid/content/ServiceConnection;)Z", "GetBindIsolatedService_Landroid_content_Intent_Landroid_content_Context_BindServiceFlags_Ljava_lang_String_Ljava_util_concurrent_Executor_Landroid_content_ServiceConnection_Handler", ApiSince=34)]
public virtual bool BindIsolatedService(Android.Content.Intent service, Android.Content.Context.BindServiceFlags flags, string instanceName, Java.Util.Concurrent.IExecutor executor, Android.Content.IServiceConnection conn);
[<Android.Runtime.Register("bindIsolatedService", "(Landroid/content/Intent;Landroid/content/Context$BindServiceFlags;Ljava/lang/String;Ljava/util/concurrent/Executor;Landroid/content/ServiceConnection;)Z", "GetBindIsolatedService_Landroid_content_Intent_Landroid_content_Context_BindServiceFlags_Ljava_lang_String_Ljava_util_concurrent_Executor_Landroid_content_ServiceConnection_Handler", ApiSince=34)>]
abstract member BindIsolatedService : Android.Content.Intent * Android.Content.Context.BindServiceFlags * string * Java.Util.Concurrent.IExecutor * Android.Content.IServiceConnection -> bool
override this.BindIsolatedService : Android.Content.Intent * Android.Content.Context.BindServiceFlags * string * Java.Util.Concurrent.IExecutor * Android.Content.IServiceConnection -> bool
Parameters
- service
- Intent
This value cannot be null .
- flags
- Context.BindServiceFlags
This value cannot be null .
- instanceName
- String
This value cannot be null .
- executor
- IExecutor
This value cannot be null . Callback and listener events are dispatched through this Executor , providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor() . Otherwise, provide an Executor that dispatches to an appropriate thread.
- conn
- IServiceConnection
This value cannot be null .
Returns
See bindIsolatedService(Intent,int,String,Executor,ServiceConnection) Call BindServiceFlags.of(long) to obtain a BindServiceFlags object.
- Attributes
Remarks
See bindIsolatedService(Intent,int,String,Executor,ServiceConnection) Call 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
BindIsolatedService(Intent, Int32, String, IExecutor, IServiceConnection)
Variation of #bindService that, in the specific case of isolated
services, allows the caller to generate multiple instances of a service
from a single component declaration.
[Android.Runtime.Register("bindIsolatedService", "(Landroid/content/Intent;ILjava/lang/String;Ljava/util/concurrent/Executor;Landroid/content/ServiceConnection;)Z", "GetBindIsolatedService_Landroid_content_Intent_ILjava_lang_String_Ljava_util_concurrent_Executor_Landroid_content_ServiceConnection_Handler", ApiSince=29)]
public virtual bool BindIsolatedService(Android.Content.Intent service, int flags, string instanceName, Java.Util.Concurrent.IExecutor executor, Android.Content.IServiceConnection conn);
[<Android.Runtime.Register("bindIsolatedService", "(Landroid/content/Intent;ILjava/lang/String;Ljava/util/concurrent/Executor;Landroid/content/ServiceConnection;)Z", "GetBindIsolatedService_Landroid_content_Intent_ILjava_lang_String_Ljava_util_concurrent_Executor_Landroid_content_ServiceConnection_Handler", ApiSince=29)>]
abstract member BindIsolatedService : Android.Content.Intent * int * string * Java.Util.Concurrent.IExecutor * Android.Content.IServiceConnection -> bool
override this.BindIsolatedService : Android.Content.Intent * int * string * Java.Util.Concurrent.IExecutor * Android.Content.IServiceConnection -> bool
Parameters
- service
- Intent
Identifies the service to connect to. The Intent must specify an explicit component name.
- flags
- Int32
Operation options for the binding as per #bindService.
- instanceName
- String
Unique identifier for the service instance. Each unique name here will result in a different service instance being created. Identifiers must only contain ASCII letters, digits, underscores, and periods.
- executor
- IExecutor
Callbacks on ServiceConnection will be called on executor. Must use same instance for the same instance of ServiceConnection.
- conn
- IServiceConnection
Receives information as the service is started and stopped. This must be a valid ServiceConnection object; it must not be null.
Returns
Returns success of binding as per #bindService.
- Attributes
Remarks
Variation of #bindService that, in the specific case of isolated services, allows the caller to generate multiple instances of a service from a single component declaration. In other words, you can use this to bind to a service that has specified android.R.attr#isolatedProcess and, in addition to the existing behavior of running in an isolated process, you can also through the arguments here have the system bring up multiple concurrent processes hosting their own instances of that service. The <var>instanceName</var> you provide here identifies the different instances, and you can use #updateServiceGroup(ServiceConnection, int, int) to tell the system how it should manage each of these instances.
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.