Alarm manager is the best option.

On Jan 4, 9:33 am, Jacob <jacobroutolo...@gmail.com> wrote:
> Hi all
>
> My requirement:
>
> Need some piece of code executing every 5 minutes (no UI). This code
> needs to access server thru internet and get some data and use them on
> the device. This code is not heavy weight. Just light weight fetch of
> 5K to 10K. And the data is not always fetched. Data fetch from server
> happens only once a day or so.
>
> I thought about a service and have written one with a timer and a
> thread (does the server data fetch). But I read some articles and docs
> that a service might be *killed* by the OS in low memory or idle
> situations.
>
> Question:
>
> Whats the suggested method to achieve this goal in android? I would
> like the code to run even in low memory situations or at least be run
> after the memory situation gets better in the OS (OS can kill my code/
> app and restart the code when its better; but don't wanna wait for
> hours).
>
> Thank you for the help!
> Jacob.

-- 
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