Stop Android Location Service if Location Doesn't Change After a Time -
i trying code service repeatedly checks user location, shuts off if things don't occur within 3 minutes. put shut-the-service-off-logic in onlocationchanged. realized if user puts phone on table , leaves there onlocationchanged may never called, , shutoff logic never entered. there other method overridden gets called every time location requested? need manually call onlocationchanged (and idea?).
create countdowntimer
, set millisinfuture
3 minutes. in onfinish()
of timer removelocationupdate
. start timer when requestlocationupdate
, cancel , start timer again in onlocationchanged.
Comments
Post a Comment