I have a library, say LIB, which exposes the quite a few APIs and classes for use by application developers.
If there are more than one applications that use LIB on the phone, I want only one instance of LIB to be created and running. It is somewhat similar to what Android Platform Services like LocationManager, SensorManager, PackageManager etc.
Specifically, there are two problems that are to be addressed:-
- How to make sure that there is only one instance of LIB ?
- How to deploy LIB(separate apk/ bundled with every application that uses it, but only one of them creating the library instance at any point of time) etc.
- Is there any other way(other than service/AIDL) to make sure that only one instance of LIB runs irrespective of the number of applications using it.