<service android:enabled=["true" | "false"] android:exported=["true" | "false"] android:icon="drawable resource" android:isolatedProcess=["true" | "false"] android:label="string resource" android:name="string" android:permission="string" android:process="string" > . . . </service>
Servicesubclass) as one of the application's components. Unlike activities, services lack a visual user interface. They're used to implement long-running background operations or a rich communications API that can be called by other applications.
All services must be represented by
<service> elements in
the manifest file. Any that are not declared there will not be seen
by the system and will never be run.
true" if it can be, and "
false" if not. The default value is "
<application> element has its own
enabled attribute that applies to all
application components, including services. The
attributes must both be "
true" (as they both
are by default) for the service to be enabled. If either is
false", the service is disabled; it cannot be instantiated.
true" if they can, and "
false" if not. When the value is "
false", only components of the same application or applications with the same user ID can start the service or bind to it.
The default value depends on whether the service contains intent filters. The
absence of any filters means that it can be invoked only by specifying
its exact class name. This implies that the service is intended only for
application-internal use (since others would not know the class name). So in
this case, the default value is "
On the other hand, the presence of at least one filter implies that the service
is intended for external use, so the default value is "
This attribute is not the only way to limit the exposure of a service to other
applications. You can also use a permission to limit the external entities that
can interact with the service (see the
The label should be set as a reference to a string resource, so that it can be localized like other strings in the user interface. However, as a convenience while you're developing the application, it can also be set as a raw string.
Servicesubclass that implements the service. This should be a fully qualified class name (such as, "
com.example.project.RoomService"). However, as a shorthand, if the first character of the name is a period (for example, "
.RoomService"), it is appended to the package name specified in the
There is no default. The name must be specified.
, has not been granted this permission, the method will not work and the Intent object will not be delivered to the service.
processattribute can set a different default for all components. But component can override the default with its own
processattribute, 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.