android AlarmManager behavior when application is forced to close

拥有回忆 提交于 2019-12-12 00:50:18

问题


I use AlarmManager to issue local notifications to user. But if I kill my application using Settings->Apps->Stop, alarm manager seems to be destroyed and all the notification icons disappears from status bar.

It it normal? The idea of local notifications is to persuade user to start my great app if it's closed. And it seems odd for me that they are being wiped out if I kill the app.


回答1:


If you KILL your application you also kill the AlarmManager. There is nothing odd about it. You close the app by pressing the home button, not by killing it via the settings.




回答2:


Use service to set AlarmManager and notification.

Also keep in mind that once device is restarted Alarm is cancelled.

So you will need to set broadcast receiver.

look at this Click here



来源:https://stackoverflow.com/questions/13969709/android-alarmmanager-behavior-when-application-is-forced-to-close

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