Android alarm is cancelled after closing the application

后端 未结 7 1023
遥遥无期
遥遥无期 2020-12-03 04:45

I have a problem with AlarmManager, I set the code for scheduling a repeating alarm and after I run the application, the alarm runs fine. Even if I click on Home button (and

7条回答
  •  心在旅途
    2020-12-03 05:24

    This is normal behaviour. If the user voluntarily force stop the applicaiton, then it should be stopped. Else, you are creating a virus like application.

    If you really want, you could write another service which monitors if your other service is running and runs the service if the one is not running. But this will be another application and (you hope) the user wont kill this app using task manager.

    Personally, I wouldn't worry. If the user stopped it, they wanted to stop it. Don't annoy the user.

提交回复
热议问题