问题
I have one DATE_CHANGED BroadcastReciever
in my application but it seems its not firing up at mid night instead its firing my myreciever at 12.00 day time.
i have declare this in manifest file as
<receiver android:name=".DateChangedReceiver" >
<intent-filter>
<action android:name="android.intent.action.DATE_CHANGED" />
</intent-filter>
</receiver>
and my DateChangedReceiver.java file is like
public class DateChangedReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equals(Intent.ACTION_DATE_CHANGED)){
//my task...
}
}
}
any idea why is this happening. Help Guys.
回答1:
android.intent.action.DATE_CHANGED fires when user manually changes date from settings of phone not for change of day. I have faced that problem and finally use AlarmManager.
来源:https://stackoverflow.com/questions/10831789/date-changed-broadcast-is-not-being-fired