Udostępnij za pośrednictwem


Context.BindIsolatedService Method

Definition

Overloads

BindIsolatedService(Intent, Context+BindServiceFlags, String, IExecutor, IServiceConnection)
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.

BindIsolatedService(Intent, Context+BindServiceFlags, String, IExecutor, IServiceConnection)

[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
instanceName
String
executor
IExecutor

Returns

Attributes

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.

Java documentation for android.content.Context.bindIsolatedService(android.content.Intent, int, java.lang.String, java.util.concurrent.Executor, android.content.ServiceConnection).

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