Reputation: 135
How to detect day pass (23:59-00:00) in Android? I'm used Broadcast receiver but it is only working when set a date from settings.
<receiver android:name=".DateChangedReceiver"
android:enabled="true"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.DATE_CHANGED" />
<action android:name="android.intent.action.TIME_SET" />
<action android:name="android.intent.action.TIME_TICK" />
<action android:name="android.intent.action.TIMEZONE_CHANGED" />
</intent-filter>
</receiver>
Upvotes: 3
Views: 565
Reputation: 39013
Use the AlarmManager to set an alarm at midnight.
You'll need to set it after it fires, and also if you receive the DATE_CHANGED, TIME_SET or TIMEZONE_CHANGED events.
Upvotes: 1