0

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.

Nick
  • 3,205
  • 9
  • 57
  • 108

2 Answers2

2

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.

Lama
  • 2,886
  • 6
  • 43
  • 59
  • For instance, if I kill my mail client, I go on getting new mail notifications. I want my app to jog the user up once a day even if my app is killed. I think it's exactly what `AlarmManager` in conjunction with `NotificationManager` must do. – Nick Dec 20 '12 at 10:31
  • No. They will just call your app in case it's active. When I, as a user, don't want an app to be active it has to stay that way. Everything else would be a big security issue. No brodcast receiver will help you with this. – Lama Dec 20 '12 at 13:26
1

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

sandy
  • 3,311
  • 4
  • 36
  • 47
  • how can introduction to `AlarmManager` usage help me with my question? – Nick Dec 20 '12 at 10:24
  • I am thinking over it... First, I want to make sure that `AlarmManager`'s death is a normal behavior in case of killing the app. – Nick Dec 20 '12 at 10:41