I am calling a background Service
at interval of 30 min to read the latitude/longitude of current location and sending it to server by POST API .
I am using
You need to use a BroadcastReceiver
and a wakelock to reliably make this happen when the device is idle. Also, note that starting with API 19 alarms are inexact by default, which will play into this. if you are targeting API 21 or newer, consider using JobScheduler
. Similar to this post Alarm Manager with 2 pending intents only 1 works?