Question

I would like to pass a intent to a IntentService in a given interval, specified by the user.

I'm considering to use the AlarmManager, but I don't need the intent to be fired if the app isn't running. And according to what I've read the AlarmManager will wake up the app.

Another option would be to run a method with a Timer. Is it possible to extend the Application class and have a timer that sends a intent to the IntentService, or is that an inappropriate solution.

Thankful for advice :)

Was it helpful?

Solution

You could extend the application class but the design will be more flexible if you run seperate timers in each of your activites, turning them on/off as required. Especially if you envisage ever using seperate threads.

Also take a look at PendingIntents they provide a simple mechanism to get the data you need back from the service.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top