yes use alarm manager to start your service  and once work is done ,
self stop the service

On Jan 4, 12:43 pm, Kumar Bibek <[email protected]> wrote:
> Alarm manager is the best option.
>
> On Jan 4, 9:33 am, Jacob <[email protected]> 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 [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