Wow, guys thats brilliant, thanks so much! I will look at both of your suggestions, and update this thread as soon as there is something to talk about, - or a question arises! (Though for the wider ranging prototype I will probably go for the implementation that is quicker to accomplish).
Btw, I dont want to use GPS at all (in this version at least) because usually an accuracy of up to 200 m would be enough, which I think is provided by the network, at least in Urban areas (well, I hope so at least?). Cheers and thx again! On Dec 6, 4:55 pm, ip332 <[email protected]> wrote: > Sorry, I don't understand both statements. > I'm using described postAtTime() method in several cases and none of > them could be called 24/7 "service". Obviously it can be implemented > as a service but regardless of mode (app/service) it doesn't consume > the CPU/battery between calls. > Compare this approach with a straightforward request location update > inside onStart() and disable it during onPause() and you should see > the difference. > I don't have time to look into AlarmManager implementation to prove > that it has a similar approach and using AlarmManager gives you > absolutely no advantage in CPU/batter nor RAM. > Of course you can try to kill your process after each 15 minutes > interval to save RAM which is impossible in my case but honestly > speaking, killing the process is not required by Android and there > were serious reasons for that. > Regards > Igor > On Dec 6, 7:11 am, Mark Murphy <[email protected]> wrote: > > > > > > > > > On Sun, Dec 5, 2010 at 9:38 PM, ip332 <[email protected]> wrote: > > >> > Or should I try to create a kind of service thread that polls every > > >> > (n) minutes and sleeps in between, would that save battery? > > > >> Yes, but it will waste RAM and cause you to be the target of task > > >> killers. > > > I disagree - it depends on how do you implement actual "runner". > > > > IMHO if you create location listener every X minutes and remove it > > > after you got a location update (10-60 seconds) - there is no wasted > > > RAM nor battery. > > > If you have a Service running 24x7 to accomplish this, yes, you are wasting > > RAM. > > > > Also I would implement it using Hanlder.postAtTime() approach > > > described > > > athttp://developer.android.com/resources/articles/timed-ui-updates.html > > > Which implies a Service running 24x7, which means users will attack > > you with task killers. > > > We can do better than this, with AlarmManager, but the work is just a > > bit tricky. > > > -- > > Mark Murphy (a Commons > > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > > Android 2.2 Programming Books:http://commonsware.com/books -- 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

