开发者

Android Service Distribution

开发者 https://www.devze.com 2023-01-18 08:33 出处:网络
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

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 :

  1. When some android appl开发者_如何学JAVAication try to use its API on the phone and suppose that service is not available on the phone then what will happen ?
  2. How will android application developer will make sure that the service is available on the phone ?
  3. 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


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?

If they are smart, they will use PackageManager to see if you are installed first. Otherwise, their attempt to call startService() or bindService() will fail.

How will android application developer will make sure that the service is available on the phone ?

Use PackageManager.

Does application developer has to bundle service with his application?

How are we supposed to know? You are the person who wrote it.

If yes then wont be there multiple instances of same service on phone if multiple application contains same service on the phone ?

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消