I am designing an alarm clock app, and I need to listen to two system broadcasts: Intent.ACTION_TIME_CHANGED
and Intent.ACTION_DATE_CHANGED
.
I believe ACTION_TIME_CHANGED
is fired when the user manually changes the time. But when is ACTION_DATE_CHANGED
broadcasted?
The documentation of this action is not quite convincing. It says,
The date has changed.
Who changed the date? The user, by changing the date setting? Or did the clock tick over to the next day?
Two Stack Overflow answers that I found regarding this:
- Answer 1: The broadcast is fired when the clock ticks over to the next day.
- Answer 2: The broadcast is fired when the user manually changes the date, and is not automatically triggered by the system.
The two answers indicate completely different behaviour. If answer #1 is correct, I will listen to this broadcast using a context-registered receiver. If answer #2 is correct, I need to register a context-registered receiver for Intent.ACTION_TIME_TICK
and then manually check whether we are in the next day or the same day.