DATE_CHANGED Broadcast is not being fired

好久不见. 提交于 2019-12-11 04:44:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!