Reputation: 25864
I have a strange situation which I freely admit, is not ideal,
I have two different apps, each that use an Android Library Project
. This library project contains a Service
which doesn't have any special intent filters defined in the AndroidManifest
of the container project.
How is it possible for me to start the service of one of these apps rather than the other, given that they have the same namespace (from external to both apps).
Note, using Intent intent = new Intent("com.example.utils.URIReceiverService");
will randomly start one, or the other Service
randomly.
Upvotes: 0
Views: 44
Reputation: 1006574
How is it possible for me to start the service of one of these apps rather than the other, given that they have the same namespace (from external to both apps)
Well, by default, you can't, since those services will not be exported.
If they are exported, you can craft a ComponentName
, which identifies the package of the app, plus the fully-qualified class name of your service, and use that with startService()
or bindService()
. Of course, anyone else can craft a similar Intent
, so think through your security.
Upvotes: 1