I have developed an android service. Any android app can use it’s API’s to get some kind of news updates from this service. I want to distribute this service so that any android app on the phone can use this service. My questions here are :
- When some android application try to use its API on the phone and suppose that service is not available on the phone then what will happen ?
- How will android application developer will make sure that the service is available on the phone ?
- Does application developer has to bundle service with his application ? If yes then wont be there multiple instances of same service on phone if multiple application contains same service on the phone ?
Thanks
Dalvin
If they are smart, they will use
PackageManagerto see if you are installed first. Otherwise, their attempt to callstartService()orbindService()will fail.Use
PackageManager.How are we supposed to know? You are the person who wrote it.
Possibly. It is difficult to answer this question in the abstract, as there are multiple ways to distribute this service (as an APK, as an Android library project, as a JAR, as just a hunk of source code) and multiple ways to integrate it (change the source code, use the source/JAR/library as-is, reference the existing APK).