So to make sure I understand this correctly:
App A = my second add-on app
App B = my other app that contains the service in question
If the service is not running and I start it from App A, the service will run in its own process regardless of whether or not App B is running
If the service is running (in memory) and App B is running (in memory), I can stop the service then restart the service and it will still be part of App B's process
Is this right?
If so, I assume I can start it with (just using sample code from this thread):
Dim p As Phone
Dim i As Intent
So what code would I use to stop it?
What code can I use to see if it is running?
The service starts every 10 seconds. It may not be actively doing something, but I want to be able to tell if it is
doing something or scheduled
to do something (i.e. it could start up again while App A is trying to do its thing).
I may even be over-thinking this. The service in question is not
set to "run in the foreground". So is it possible that while my add-on app (App A) is doing its thing for a few seconds and then closing that this alone would temporarily suspend the service in App B and keep the two from interfering with each other?
What the service does is pulls some data from a satellite receiver every 10 seconds then refreshes a notification. The add-on app can send macros (several remote commands) one after another. But if they get interrupted it can cause the macros to fail. So I don't want my other service requesting data from that same satellite receiver while the macro is executing.
Another option would be that my service in App B checks to see if App A is actively running (or a service in App A is running) and if so, reschedule itself for 20 seconds later. But if I did this, I would need to know if the app is in the foreground or if it is suspended. App A either sends the commands from the activity or starts its own service to send the commands, but once done, Activity.Finish is called. App A (or its service) is only doing something for 1 second to maybe 10 seconds.