>> Another option >> could be periodically starting a service with an alarm, try to get the >> location and then shut down the location updates. In this way I would >> be pretty sure the radio is off when I don't need location updates. > > Right. Creating a variation on WakefulIntentService that supports this > pattern is one of the 18,000 items on my to-do list. :-) >
I bring up this thread again, because I am trying to implement this solution, but I am having some issues. I think a classic service would be more suitable than an IntentService for this purpouse. The intent service, and therefore your wakeful one, does its job and then dies after the onHandleIntent is called. If you implement a locationlistener, you'll never know (or, you can't predict) when you will get the first location update (which is also the one you need, at least until the next alarm triggering), so you need something that stays alive until it gets the first fix. However, also in this situation, I can start the service and make it kill himself where the location is found (or after a reasonable amount of time). I gave also a look at the code of MyTracks, and they just keep the locationlistener still alive for all the duration of the "recording period". It would be a lot easier if the radio is turned on only during the location updates, but looking at android code, it seems that GpsLocationProvider is just "enabled" (and then I suppose the radio is turned on). Thanks again Federico -- 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