你就可以开始在一个单独的进程中IntentService? [英] Can you start an IntentService on a separate process?
问题描述
- 是否有可能启动 IntentService 的上一个单独的进程?怎么样?如果是这样,是强制绑定到它?
- 是否有可能启动 IntentService 在一个单独的流程和的run它在前台的?
- 什么是
机器人之间的区别:
isolatedProcess和安卓过程
?参见:<一href="http://developer.android.com/guide/topics/manifest/service-element.html">http://developer.android.com/guide/topics/manifest/service-element.html
1)是否有可能启动
IntentService
在一个单独的进程?怎么样?如果是这样,是强制绑定到它?
是的,你可以在一个单独的进程启动 IntentService
。只需添加安卓程序=:什么。
来该服务的清单条目
没有,你不需要绑定到它。您可以通过发送其意图使用与它通信 startService()
2)是否有可能启动IntentService在一个单独的进程,并在前台运行呢?
是的(见上文)。为了让您的服务在前台运行,它可以调用 startForeground()
时,它要做到这一点。该服务本身是它是否运行在前台或后台控制。
3)什么是
机器人之间的区别:和isolatedProcess
安卓过程
?参见:<一href="http://developer.android.com/guide/topics/manifest/service-element.html">http://developer.android.com/guide/topics/manifest/service-element.html
安卓过程
允许您控制在处理每个特定的组件运行(通过指定进程的名称)。您可以将您的应用程序的组件组在单独的进程中运行(例如,所有的UI组件在一个进程,而在另一个所有服务)。默认行为是,一个应用程序的所有组件在同一进程中运行。
安卓isolatedProcess
是一个标志(真/假),您可以设置,如果你想有一个特殊的服务组件在一个单独的进程,从其他地区隔离运行应用。分离的过程中没有任何授予给应用程序的其余部分的权限。通常情况下,权限授予应用程序和应用程序的所有组件都应用程序获取权限。 安卓isolatedProcess
仅在开始提供API级别16(杰利贝恩)。请参阅<一href="http://aleksmaus.blogspot.de/2012/09/a-feature-of-android-jelly-bean.html">http://aleksmaus.blogspot.de/2012/09/a-feature-of-android-jelly-bean.html和<一href="http://stackoverflow.com/questions/11681115/advantage-of-introducing-isolatedprocess-tag-within-services-in-jellybeanandroi">Advantage在软糖介绍Isolatedprocess标签内服务[机器人]
- Is it possible to start an IntentService on a separate process? How? If so, is it mandatory to bind to it?
- Is it possible to start an IntentService on a separate process AND run it in the foreground?
- What's the difference between
android:isolatedProcess
andandroid:process
? See: http://developer.android.com/guide/topics/manifest/service-element.html
1) Is it possible to start an
IntentService
on a separate process? How? If so, is it mandatory to bind to it?
Yes, you can start an IntentService
in a separate process. Simply add android:process=":whatever"
to the manifest entry for that service.
No, you don't need to bind to it. You can communicate with it by sending it Intents using startService()
2) Is it possible to start an IntentService on a separate process AND run it in the foreground?
Yes (see above). To make your service run in the foreground it can call startForeground()
whenever it wants to do that. The service itself is in control of whether it runs in the foreground or background.
3) What's the difference between
android:isolatedProcess
andandroid:process
? See: http://developer.android.com/guide/topics/manifest/service-element.html
android:process
allows you to control in which process each particular component runs (by specifying the name of the process). You can group components of your application to run in separate processes (for example, all UI components in one process and all services in another). The default behaviour is that all components of an application run in the same process.
android:isolatedProcess
is a flag (true/false) that you can set if you want a particular service component to run in a separate process isolated from the rest of your application. The isolated process doesn't have any of the permissions that are granted to the rest of your application. Normally, permissions are granted to an application and all components of the application have all the permissions that the application gets. android:isolatedProcess
is only available starting with API level 16 (Jellybean). See http://aleksmaus.blogspot.de/2012/09/a-feature-of-android-jelly-bean.html and Advantage of introducing Isolatedprocess tag within Services in JellyBean[Android]
这篇关于你就可以开始在一个单独的进程中IntentService?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!