Android P Beta - AlarmManager Notifications not working

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 14:02:26

As you yourself mentioned the new App Standby Buckets feature of Power Management is likely to be the cause. The new documentation states:

If an app is in the frequent bucket [or below], the system imposes stronger restrictions on its ability to run jobs and trigger alarms

and

In particular, the bucket determines how frequently the app's jobs run, how often the app can trigger alarms

Additionally, if you view Power Details you can get a rough idea of the delay times.

Worth noting is that it appears your bucket is based on average usage (and machine learning) not on current usage - which means even if your app has just been in the foreground, the buckets play some role

This is happening because of Power management feature introduced in Android Pie.

In android P, strict restrictions are introduced on the apps running in background. These restrictions are explained here

As we can see in the above link, if we connect the device to charging there are no restrictions imposed on the device and notifications are working properly. However, if we remove the device then Android system adds the certain restrictions for the apps running in background.

We can turn off this restrictions by turning off battery optimization for our application from device settings. Search for battery optimization in settings and turn it off for our application.

Also, testing the notifications by changing the device date and time was a hack that worked fine till now but in Android P, we've to either test them in real time scenario or turn off battery optimization for our application to test them.

I hope this will clear our doubts.

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