AlarmManager repeating alarm missing randomly when phone is not in use

前端 未结 3 2011
南旧
南旧 2021-02-05 22:24

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

3条回答
  •  生来不讨喜
    2021-02-05 23:14

    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?

提交回复
热议问题