Context.BindIsolatedService 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| BindIsolatedService(Intent, Context+BindServiceFlags, String, IExecutor, IServiceConnection) |
请参阅 bindIsolatedService(Intent,int,String,Executor,ServiceConnection) 调用 BindServiceFlags.of(long),以获取 BindServiceFlags 对象。 |
| BindIsolatedService(Intent, Int32, String, IExecutor, IServiceConnection) |
|
BindIsolatedService(Intent, Context+BindServiceFlags, String, IExecutor, IServiceConnection)
请参阅 bindIsolatedService(Intent,int,String,Executor,ServiceConnection) 调用 BindServiceFlags.of(long),以获取 BindServiceFlags 对象。
[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
参数
- service
- Intent
此值不能为 null。
- flags
- Context.BindServiceFlags
此值不能为 null。
- instanceName
- String
此值不能为 null。
- executor
- IExecutor
此值不能为 null。 回调和侦听器事件通过此执行程序调度,提供一种简单的方法来控制使用哪个线程。 若要通过应用程序的主线程调度事件,可以使用 Context.getMainExecutor() 。 否则,请提供调度到相应线程的执行程序。
- conn
- IServiceConnection
此值不能为 null。
返回
请参阅 bindIsolatedService(Intent,int,String,Executor,ServiceConnection) 调用 BindServiceFlags.of(long),以获取 BindServiceFlags 对象。
- 特性
注解
请参阅 bindIsolatedService(Intent,int,String,Executor,ServiceConnection) 调用 BindServiceFlags.of(long),以获取 BindServiceFlags 对象。
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。
适用于
BindIsolatedService(Intent, Int32, String, IExecutor, IServiceConnection)
#bindService在独立服务的特定情况下,这种变化允许调用方从单个组件声明生成服务的多个实例。
[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
参数
- service
- Intent
标识要连接到的服务。 意向必须指定显式组件名称。
- flags
- Int32
绑定的操作选项按 #bindService。
- instanceName
- String
服务实例的唯一标识符。 此处的每个唯一名称都会导致创建不同的服务实例。 标识符只能包含 ASCII 字母、数字、下划线和句点。
- executor
- IExecutor
将在执行程序上调用 ServiceConnection 上的回调。 必须为同一 ServiceConnection 实例使用相同的实例。
- conn
- IServiceConnection
在启动和停止服务时接收信息。 这必须是有效的 ServiceConnection 对象;它不能为 null。
返回
根据 #bindService.. 返回绑定成功。
- 特性
注解
#bindService在独立服务的特定情况下,这种变化允许调用方从单个组件声明生成服务的多个实例。 换句话说,可以使用它绑定到已指定的 android.R.attr#isolatedProcess 服务,除了在隔离进程中运行的现有行为外,还可以通过此处的参数让系统启动托管其自己的该服务实例的多个并发进程。 此处提供的 instanceName 标识不同的实例,可用于 #updateServiceGroup(ServiceConnection, int, int) 告知系统如何管理其中每个实例。
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。