0

I am developing an application for a certain event like a count down.

In the foreground of the app I show the days, hours, minutes and seconds left till the event date/time with handler.

However, I'd like to be able to detect start of new day (when app is in background) and show a notification in the status bar like '29 days left'. I want to receive this event whenever the system date automatically changes to new day (23:59 -> 00:00) everyday until the end date of my event.

Having said all this, how can I achieve this with the AlarmManager (or any other way)?

I know how to set up broadcast receivers, I just don't know how to schedule the event to occur precisely when a new day has come.

Speed Demon
  • 691
  • 1
  • 9
  • 21

1 Answers1

0

I would consider using Joda Time, and use the withTimeAtStartOfDay method to get the next alarm.

Uriel Frankel
  • 14,304
  • 8
  • 47
  • 69