Ohh thanks, i thought that Timer + Handler will open a new thread
instead of be on the main UI thread.

So, i can combine a timer + handler + AsyncTask, right? If I
understood I think is what you said.

Thanks Kostya!

On 17 ene, 12:27, Kostya Vasilyev <kmans...@gmail.com> wrote:
> Oh, I see.
>
> You might not need a service or alarms then - a Handler with postAtTime()
> should do the trick.
>
> Since you'll be doing networking, make you do it from a background thread,
> so as to not block the application's UI.
>
> Android provides a class that makes this easy: AsyncTask.
>
> -- Kostya
>
> 2011/1/17 Sergio Luceno <slucen...@gmail.com>
>
>
>
>
>
>
>
> > thanks Kostya,
>
> > I don't know if I explained well what i wanna mean when i say sync the
> > app.
>
> > What i try to have sync is the data of the application. I mean, the
> > user can modify his data through movile device, or accessing via web,
> > in the future maybe through facebook, etc.
>
> > So i think is quite enough if the process run only while the user is
> > using the application. I think i don't need sync while the user is
> > doing whatever and my app is on memory. Or maybe yes.... i don't
> > know. :D
>
> > I am gonna take a look to AlarmManager.
>
> > On 17 ene, 12:04, Kostya Vasilyev <kmans...@gmail.com> wrote:
> > > Sergio,
>
> > > A Handler only works for as long as your process is "alive", which may
> > not
> > > be a good thing.
>
> > > Use AlarmManager for scheduling - it can wake the phone up (if you need
> > > this) and will reload the process if it was kicked out of memory.
>
> > > For the actual updates, take a look at IntentService (part of SDK) or
> > > WakefulIntentService (Mark Murphy's enhanced version, Google for it).
>
> > > -- Kostya
>
> > > 2011/1/17 Sergio Luceno <slucen...@gmail.com>
>
> > > > Hi!
>
> > > > My application has to be syncronized every 5 minutes against a server.
> > > > I have to schedule a HTTP call to my server to get sync.
>
> > > > What is the best way to achieve that?
>
> > > > Now I tried to make a timer with a handler.
> > > > I'm passing a message every 5 minutes to execute my action.
>
> > > > Thanks in advance.
>
> > > > --
> > > > 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%2Bunsubs
> > > >  cr...@googlegroups.com><android-developers%2Bunsubs
> > cr...@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<android-developers%2Bunsubs 
> > cr...@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