Broadcast Intent when changing date?

I would like to know if the android intends to check for changes in the system date. I want an intention that translates when the time changes from 23:59 to 00:00 (next date). I searched the net and found about android.intent.action.DATE_CHANGED, but it seems that this intention is broadcast only if the date is changed manually.

If there is no such intention as this, let me know if there is an alternative. One alternative that I can think of is to use AlarmManger and broadcast the pending intent. Is there anything simpler?

+7
source share
2 answers

Use AlarmManager and schedule an alarm at midnight.

LINK: A small tutorial for AlarmManager.

btw, I tried to find this answer! Thanks.

+5
source

This should not be difficult to implement using the AlarmManager. To run the application, just a few instructions are enough, setting the pending intent of the alarm manager.

Context.getSystemService(Context.ALARM_SERVICE); 

Delete all alarms with the appropriate intent. Do it first.

 cancel(PendingIntent operation); 

Schedule an alarm. Just add 24 hours or whatever makes sense to your needs.

 set(int type, long triggerAtTime, PendingIntent operation); 
+2
source

All Articles