samedi 23 juillet 2016

What is the correct way to use repeating alarms for short intervals in Android 5.0+?

So I need to send coordinates from my current location to a server, in very short frequences (30 seconds). Right now I am doing it with AlarmManager setRepeating(), but Android 5.0+ allows intervals from up to 1 minute to save battery.

My question would be:

Is my way really efficient? I need to run this repeating alarm in the background, even when the device is off. Currently I am executing pendingintent which leads to a broadcastreceiver which in turn executes to asynctasks, one for server authentication, one for posting the coordinates.

Aucun commentaire:

Enregistrer un commentaire