Hi,
One of my application need to know a new day is coming, that is,
if the clock of phone changed from 23:59 to 00:00, my application will
do some logic. I tried to use android.intent.action.DATE_CHANGED, but
based on my test, this event only occured when i change the date
mannually, I could not get this action when clock changed from 23:59
to 00:00. Does anybody know why?
This is the defination in AndroidMainfest.xml
<receiver android:name=".DateBoradcastReceiver"
android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.TIME_SET"/
>
<action
android:name="android.intent.action.DATE_CHANGED"/>
</intent-filter>
Below is the code in DateBoradcastReceiver class:
public void onReceive(Context arg0, Intent arg1) {
Log.d("PregnancyWidget", "intent= "
+ arg1);
String action = arg1.getAction();
if (action.equals(Intent.ACTION_DATE_CHANGED)||action.equals
(Intent.ACTION_TIME_CHANGED)) {
//business logic is here
}
}
Thanks in advance for your help.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en