[android-developers] Re: How can I know date changed? seems android.intent.action.DATE_CHANGED works not properly
Hi Adamphillips,
Thanks for your help. But in my testing, the "Intent.
ACTION_DATE_CHANGED" action never be broadcast whatever I set time to
past or future.
Could you please explain more about how to use AlartManager to know
when 12am hits?
Hi Bytes,
Do you mean "ACTION_TIME_TICK"? this will broadcast every minutes,
it's too frequent for me.
On Nov 9, 9:02 pm, adamphillips12 <adamphillip...@gmail.com> wrote:
> http://code.google.com/p/android/issues/detail?id=2880&can=4&colspec=...
>
> Though you can use the AlarmManager to help you keep track of when
> 12am hits.
>
> On Nov 8, 1:32 pm, NewPa <shiji...@gmail.com> 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 ichangethedate
> > 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home