I'm working on a small test program to try and understand how the service apps work.
I want to run a service that I use intensely for say 2 x 30 mins every 3 weeks or so. at the moment I run it as a foreground app but several things can push it to background and stop it working properly so service seems the way to go.
I understand that Android wants to handle resources and I don't mind my background service running when not needed so long as it doesn't consume cpu time, but at the moment I don't understand how I can control it other than have it poll for a global command variable from the associated foreground app. clearly polling this variable will keep the service pretty active when 99% of the time I don't need it.
Is there a way of forcing an event in a background service, so the app can be idle until the event wakes it ?
Also, how are the service & foreground app linked, it seems if I kill one, the other dies too. I though I could kill the foreground app and the service would continue.
I want to run a service that I use intensely for say 2 x 30 mins every 3 weeks or so. at the moment I run it as a foreground app but several things can push it to background and stop it working properly so service seems the way to go.
I understand that Android wants to handle resources and I don't mind my background service running when not needed so long as it doesn't consume cpu time, but at the moment I don't understand how I can control it other than have it poll for a global command variable from the associated foreground app. clearly polling this variable will keep the service pretty active when 99% of the time I don't need it.
Is there a way of forcing an event in a background service, so the app can be idle until the event wakes it ?
Also, how are the service & foreground app linked, it seems if I kill one, the other dies too. I though I could kill the foreground app and the service would continue.