date - Android widget can't receive the DATE_CHANGED message -
I am developing a calendar widget, and when I date manually . What is the problem? My code is in the manifest: And I tried to get it this way: But the log is not printed when I change the system date manually. Thank you! Update: I solved it, this is actually a bug of DATE_CHANGED. Use this intent: Get more:
& lt; Receiver Android: name = "com.widget.calendar.CalendarWidgetProvider" & gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "android.appwidget.action.APPWIDGET_UPDATE" /> & Lt; Action Android: name = "android.intent.action.DATE_CHANGED" /> & Lt; / Intent-Filter & gt; & Lt ;! - This widget specifies provider information - & gt; & Lt; Meta-Data Android: name = "android.appwidget.provider" Android: resource = "@xml / widgetinfo" /> & Lt; / Receiver & gt;
Override public zero at @Receive (reference CTX, intent to intent) { Final string action = intent.getAction (); If (action.equalsIgnoreCase ("android.intent.action.DATE_CHANGED")) {Log.e (TAG, "Date changed ..... !!!!!!!!!!!!!!!!! !!!!!!!!!!! "); } Super.onReceive (CTX, Intent); }
& lt; Intent-Filter & gt; & Lt; Action Android: name = "android.intent.action.TIME_SET" /> & Lt; / Intent-Filter & gt;
Override public null at @Receive (reference CTX, Objective of Intent) {Final string action = intent.getAction ( ); If (action.equalsIgnoreCase ("android.intent.action.TIME_SET")) {Log.e (Tag, "Date changed ..... !!!!!!!!!!!!!!!!! !!!!!!!!!!! "); } Super.onReceive (CTX, Intent); }
Comments
Post a Comment