Hi,

I have been working on an app and I'm now a bit stuck on the next bit.

Outline:-
When my app is created, it starts a service that registers for
location updates (every 5 mins as a minimum frequency).
The service also downloads info from a web-service every x mins (10 in
my case).
My main activity registers a listener for the service when something
meets the criteria and updates the list.
This all works when the app is open.

I would like the option to keep the app running in the background and
alert the user when a condition is met.
The reason I did it as a service was so that it keeps running when the
app is paused.
The system I use above works for a while (adds a notification to the
bar) but I think its being killed after a while.

I read that this is by design, which I can understand.

I have also read that the alarm manager might be a better solution.

Could I use the alarm manager to wake the service at certain intervals
(i.e. 5 mins) to check if the criteria is met?
It would need to get the latest position from the location manager as
part of the check and possibly call the web-service to get the latest
info.

Is it possible to then wake the phone, play a sound and vibrate if the
criteria is met?
Its needs to be something like when you get a text message, enough
that the user will notice the alert and look at the phone.

I know there are issues with the wake lock and the phone sleeping
again before the alert is displayed.

I suspect that some people will say that I should not do any
background stuff as it drains the battery.
I would give the user the option to turn off the background stuff if
they want to and also set the frequency.

Any thoughts?

Thanks

Edam

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