I am in the process of creating an app that is similar to the built-in SMS app.
What I need:
What I have tried:
- running a regular service which worked just fine until Android kills the service
- using the AlarmManager to make the 5 min. interval call to a service. But I was not able to make this work.
a service that is always running in the background
This is not possible in any real sense of the term, as you have discovered. It is also bad design.
every 5 min. the service checks the current location of the device and calls a web service
Use AlarmManager
.
using the AlarmManager the make the 5 min. interval call to a service. But I was not able to make this work.
Here is a sample project showing how to use one, along with the use of WakefulIntentService
so you stay awake while trying to do the whole Web service thing.
If you have continued problems with it, open up a new question about the specific things you are encountering with AlarmManager
that are giving you grief.