Android P Beta - AlarmManager Notifications not working

后端 未结 2 1458
自闭症患者
自闭症患者 2021-02-15 17:20

I\'m testing my application on Android P beta release 4. My app\'s targetSdkVersion is 27

It has been observed that alarm manager notifications are not

2条回答
  •  攒了一身酷
    2021-02-15 17:49

    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.

提交回复
热议问题