title: Saving location to server in a given interval when app is in background. Long running service vs AlarmManager
body: <p>I have an application where I want to collect users location whenever the application is put in the background. While application is in background I want to save location to server with a given intervall, like 15 min. What is the best way to do it? I have tried doing it with a long running service, but the annoying thing with the service is that it dies if system kills application due to lack of resources. I want the application to only stop collecting location if user removes it from "recent application" or Force quits it in another way. I have now set it up with an Alarm triggering a service(which stops itself after doing its location thing), but the Alarm also will be killed when lack of resources, right?</p>