3

What is the best way to set an long-term alert/reminder from an Android application? I'd like to display notification in a few weeks after current date. I believe there is no need to write a service for such task. Will AlarmManager do the trick? Or should application be started daily and performing check?

After countdown was started, upcoming alert should survive upgrading application from Android Market.

tomash
  • 12,742
  • 15
  • 64
  • 81

1 Answers1

3

Use AlarmManager. Here is code snippet and link to wider code example by CommonsWare.

Community
  • 1
  • 1
Konstantin Burov
  • 68,980
  • 16
  • 115
  • 93
  • 1
    AlarmManager does not survive reboot :-( – tomash Sep 28 '10 at 07:07
  • 3
    Then you have to re-setup alarms on boot. Take a look here http://android.arnodenhond.com/tutorials/alarm-notification#TOC-Proximity-Alerts – Konstantin Burov Sep 28 '10 at 08:03
  • As all I need is notifying user, I will probably stick with unofficial Calendar API and create calendar events with alert. – tomash Sep 28 '10 at 12:03
  • Thanks @KonstantinBurov. The link has obviously been moved here in the meantime: http://android.arnodenhond.com/development/tutorials/alarm-notification – peterp Jan 30 '13 at 22:20