Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does android:enabled mean for a service?

What does android:enabled mean for a service? The description says it's whether it can be instantiated by the system. What does that mean? Can it be used at all? Can it only be used locally? If you can use a "disabled" service in some way then how do you start it? If it can't be used at all then what in the world is the point? Can't you just comment out the service tag instead?

I was looking into creating a service that isn't to be used by other applications. Not sure if adroid:enabled can be used for this purpose.

like image 318
nick allen Avatar asked Feb 14 '12 21:02

nick allen


People also ask

What does Android enabled do?

Whether or not the Android system can instantiate components of the application — "true" if it can, and "false" if not. If the value is "true", each component's enabled attribute determines whether that component is enabled or not.

What does service enabled mean?

Enabling services means services that allow or provide for access to and the derivation of benefits from the array of basic health care services and includes activities such as out- reach, case management, health education, transportation, translation, home visits, support services, and other services. “

What is an Android service?

An Android service is a component that is designed to do some work without a user interface. A service might download a file, play music, or apply a filter to an image. Services can also be used for interprocess communication (IPC) between Android applications.


1 Answers

What does that mean?

It means whether it can run.

Can it be used at all?

Not if it is disabled.

Can it only be used locally?

Not if it is disabled.

If it can't be used at all then what in the world is the point?

android:disabled is effectively inherited, and it definitely has use cases for activities and BroadcastReceivers. In the case of a service, it would be less likely to be used, but might still have merit (e.g., an API for third parties that the user can opt out of).

Can't you just comment out the service tag instead?

Java code cannot do that at runtime. The value of android:enabled, however, can be modified through PackageManager at runtime.

like image 176
CommonsWare Avatar answered Sep 24 '22 04:09

CommonsWare