Allowing the phone to sleep while using RTC alarm on Android

∥☆過路亽.° 提交于 2019-12-01 17:00:40

Why was my service executing?

Presumably something else was having the device awake at those moments.

If another service is misbehaving and using the _WAKEUP variants of the alarm will my service wake up too?

Yes, though "misbehaving" is in the eye of the beholder.

Can I avoid being woken by another service, and just awake from the user turning the screen on?

Not directly via AlarmManager. You can watch for ACTION_SCREEN_OFF and ACTION_USER_PRESENT broadcasts, and perhaps disable your alarms between those.

I've just spent an hour trying to find out why my RTC alarm sends PendingIntents even when my phone is sleeping. And the answers is very simple, because it was pluged with USB so the phone had status "charging".

Presumably something else was having the device awake at those moments.

A lot of applications with notification ads (like AirPush, Leadbolt ect) wake up the device.

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