Let me get this straight... when it installs.. you set an alarm. You also
set a flag saying "never ran yet..". The user then runs the app for the
first time as you check the first-run flag. At that time..can't you try what
Mark said.. cancel the present alarm and then reschedule it so that there is
only one? Or.. if you can schedule the alarm on install.. why even worry
about a "first run" flag? If it works on install..it's schedule.. so the
first time they run it..the installation already took care of the scheduled
alarm. What am I missing?


On Mon, Jan 11, 2010 at 11:51 AM, sdphil <phil.pellouch...@gmail.com> wrote:

> thinking more about this, would this work?  suppose someone installs
> the app, but doesn't run it.  then reboots the phone.  now I've got
> the alarm broadcast receiver registered.
>
> then the user launches my app, my app checks the flag and decides that
> this is the first time it has ever run, so decides to register an
> alarm.
>
> now, I've got two alarms running that will go off at approximately the
> same time.
>
> i guess a solution would be to ignore second alarm when it gets
> triggered??
>
> On Jan 11, 11:06 am, Mark Murphy <mmur...@commonsware.com> wrote:
> > sdphil wrote:
> > > I am trying to have some code execute every 24 hours.
> >
> > > I discovered this (great) thread --
> > >http://groups.google.com/group/android-developers/browse_thread/threa.
> ..
> >
> > > And looked at Mark Murphy's code --
> > >http://groups.google.com/group/cw-android/web/Alarm.zip
> >
> > > But my question has to do with how to trigger the service even if the
> > > phone has not been rebooted.  In other words, suppose someone installs
> > > my application.  I would like to make it so that in 24 hours, it
> > > executes some code, whether or not the phone has been rebooted.
> >
> > Register your alarm when they first run the app. Set a flag (file,
> > shared preference, database) to let you know it was the first time you
> > were run.
> >
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com|
> http://twitter.com/commonsguy
> >
> > Android 2.0 Programming Books:http://commonsware.com/books
>
> --
> 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+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to