Suppose we have two installed APKs with the same service and same action per APK. Like a kind or library used or so.
I understand that the last installed APK actually takes charge from the service’s point of view.
When any APK binds to the service mentioning the action I cannot actually specify to which server I want to bind. Or can I?
This is important I I have two different versions of the same library used for building those APKs. My code from a certain APK may expect the service is built with certain considerations.
Strictly speaking I need to know how I can bind to a specific service if more than one have the same name, package name (different from the actual package name) and action.
I’m sorry for such painful reading…
Talented programmers can change this, in a minute or two.
Actually, AFAIK, first one in wins, not the last one.
That is not possible, as you cannot have two apps installed at the same time with the same package name.
It is possible for two apps to be installed with different package names, but that contain a
Servicewith the same fully-qualified class name and exported with an<intent-filter>sharing the same action string. This is poor design, as I noted in my comment on the question.That being said, you can use
setComponent()on theIntentused withstartService(), etc. to identify theServicein question. You will need to use the two-Stringconstructor, supplying the package name of the APK in the first parameter and the fully-qualified class name of theServicein the second parameter.