android:isolatedProcess
and android:process
? See: http://developer.android.com/guide/topics/manifest/service-element.html1) 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]