I am working on an android application that uses phonegap/cordova. This app uses a javascript to fetch content from the server from time to time and issues a systemtray alert if there is new content. The problem I was facing was that the app would eventually just quit when android was short on memory or whatsoever.
So I added a service to my manifest (everybody says a service would solve the problem).
<service android:name="UpdateService" />
Verywell, but just having this service there does nothing (obviously). So how do I make my service trigger the main application to keep running?
ADDITION: I also managed to start the service in my main application
Try registering a PendingIntent with the AlarmManager that will check to make sure your application is running every n milliseconds. If it isn't running have the service start your application again.
Use some code like this to start your application:
Replace com.myapp.LaunchActivity with your package name and LaunchActivity.