Reputation: 282
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.
Upvotes: 7
Views: 4709
Reputation: 1007266
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.
Upvotes: 13