AlarmManager not working in several devices

后端 未结 14 2072
走了就别回头了
走了就别回头了 2020-11-30 18:34

My app uses AlarmManager and it has been working since 4 years ago. But I noticed it started failing in some devices.

I\'m pretty sure code is right (I\'m using Wak

14条回答
  •  长情又很酷
    2020-11-30 19:06

    Use AlarmManager for <5.0 devices, and JobScheduler for 5.0+ devices. I can't say for sure that JobScheduler will be unaffected by manufacturer shenanigans, but it would seem much less likely to me, given that Android is trying to move people away from AlarmManager and onto JobScheduler.

    EDIT: Google has come out with a first-party solution to this problem called WorkManager. It abstracts multiple scheduling frameworks and uses the most appropriate one for the device.

提交回复
热议问题