I wouldn't expect DATE_CHANGED to be broadcast when the clock turns
midnight -- I'd presume it is only broadcast when the operator
manually changes the date (or some program does it).  Similar to
TIME_SET.

If you want to know when midnight turns over you probably need to set
up a timer, just as you would for any other specific time.

On Aug 5, 1:20 am, Ashish Panchiwala <[email protected]>
wrote:
> 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

Reply via email to