I'm a relative novice to Android progamming and have already asked some basic questions about services (http://stackoverflow.com/questions/8659622/separation-of-logic-and-gui-in-android-app-service-has-knowledge-of-app-and-sho)
This seems like a stand-alone question so I've broken it off.
I inherited some code written in Eclipse consisting of a service and app. I put the service code into a library. In the app settings, under Android, I added the service library under the Library section so I could reference the code. I'm not sure this is the correct way. I also did this in the new app I built. However, I think I'm having problems when I try to run both apps (which should use the same service) and I'm not too surprised. I download and debug the first app and it's working fine. The service makes a connection to an outside device via bluetooth. When I download and debug the second app, I notice that the first app loses it's connection. I'm guessing that the act of downloading the second app is also downloading a new copy of the service. My specific questions are:
- Can two apps share the same instance of a service?
Should I be putting the service in a library and referencing the service in both apps, or is there another (better) way? How would I reference a third party service if I didn't have the source code?
The examples I looked at, all seem to have a service and activity all in the same project. Can someone point me to a bigger example like a service with two apps that use it?
Thanks, Dave