I have a library, .aar bundle, that I want to share with other Android developers so that they can embed my code in their applications.
My library has a background service. There should only be one background service running or the services will compete for the same resources on the phone and conflict with each other.
The problem I see is that if someone has my google play app installed and then they install my partners app and I have the same service running on the phone on two apps neither app will run the way it should.
In another scenario I could have two clients using my libraries and both apps of my clients could be installed on one device. The same problem. My background service would be running on both applications and creating conflicts.
How do I distribute my .aar bundle and ensure that I only have one background service running for a shared library between two applications?
I'm wondering if maybe I am using the wrong distribution model.