Skip to content Skip to sidebar Skip to footer

What Is The Purpose Of Defined Process In Service Class Of Manifest File In Android?

I want to know the purpose of pro

Solution 1:

From Android documentation http://developer.android.com/guide/topics/manifest/service-element.html:

android:process

The name of the process where the service is to run. Normally, all components of an application run in the default process created for the application. It has the same name as the application package. The element's process attribute can set a different default for all components. But component can override the default with its own process attribute, allowing you to spread your application across multiple processes.

If the name assigned to this attribute begins with a colon (':'), a new process, private to the application, is created when it's needed and the service runs in that process. If the process name begins with a lowercase character, the service will run in a global process of that name, provided that it has permission to do so. This allows components in different applications to share a process, reducing resource usage.

Solution 2:

By default the Service will run in the application's main process. You can specify that it runs under a different process. Read about the attributes here.

Solution 3:

It means your service will run in a process named MyService. According to Android docs

A process running a service is ranked higher than a process with background activities

So if Android need memory at any time when your service is running then it is less likely to be killed by OS. Read here for more.

Post a Comment for "What Is The Purpose Of Defined Process In Service Class Of Manifest File In Android?"