Android Alarm Manager setExactAndAllowWhileIdle() not working in Android 7.0 Nougat in Doze mode

 ̄綄美尐妖づ 提交于 2019-11-30 06:40:30

You might get accurate alarms, but in Doze mode

The system ignores wake locks.

So it seems as though AlarmManager.setAlarmClock is the only acceptable solution if you really need to trigger every 30 minutes. This will probably negate all doze mode energy savings...

BTW: it seems like you can see alarms with adb shell dumpsys alarm.


Possibility: use Firebase JobDispatcher

The Firebase JobDispatcher is a library for scheduling background jobs in your Android app. It provides a JobScheduler-compatible API that works on all recent versions of Android (API level 14+) that have Google Play services installed.

I got the same problem as you, and searches a long time for an solution. But I doesn't find a general solution.

A solution for Samsung devices is available: Android AlarmManager not working on some devices when the app is closed

The first answer works not, but the second one :)

Have you tried add your app to the battery optimisation whitelist? As some news pointed out (link), Huawei has some special battery management.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!