On Thu, Dec 27, 2012 at 1:25 PM, Jake Colman <[email protected]> wrote: > Initially you said that the service should not > be destroyed so quickly.
What I wrote was: "The only reason a service would be destroyed within that short a period of time is if somebody stops it. For example, an IntentService calls stopSelf() when onHandleIntent() ends (if there is no more work queued up)." > I didn't realize that you were distinguishing > between an Intent Service and a regular service. I am uncertain how much more plain I can make what I wrote above. I am up for suggestions. > Is it acceptable practice to have my AppWidgetProvider start a regular > service to handle this kind of work? So long as that service shuts itself down once it has the location data, that's perfectly reasonable, and that's what LocationPoller does. > What about leaving everything as is but track location updates via an > Intent instead of a listener? I presume that you mean via a PendingIntent. I have not experimented with that portion of the location API. I would presume that it is designed for this sort of scenario, but I do not know all of the relevant characteristics (e.g., do we need a WakeLock?). This is on my short list to work on in early 2013. > I imagine that would be abusive since an > AppWidgetProvider shouldn't be handling a potentially continuous stream > of intents such as could be fired from the location updates. Well, as with your existing listener-based logic, you could remove updates once you got your desired fix. Part of what I need to figure out is how well stuff like minTime work with the PendingIntent stuff, to see how much power is consumed while our location request is registered. For example, it is possible that, in your scenario, you could specify a minTime of 1 hour, and Android would be smart enough to let the device (and GPS, if applicable) fall asleep between checks. Since minTime used to be a hint, and not a hard requirement, I never trusted it, but the docs suggest that minTime is more "real" now... :-) -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Localized Android Question-and-Answer Sites: http://www.andglobe.com -- 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

