android - Disable my-location when user moves the map and re-enable when he press the my-location button -
i'm using setmylocationenabled(true)
google maps android api v2 have auto location tracking , display indicator google maps app. need camera position follows my-location indicator visible, except when user pans map.
so, i'm using onmylocationchange
method move camera new location, when user pans map or use search field app, onmylocationchange
continues being called , camera comes my-location coordinates.
how can move camera automatically when my-location enabled, disable when map manually manipulated (pan, rotate or search) , enable when user press my-location button?
thanks.
edit:
there googlemap.setonmylocationbuttonclicklistener
, can skip point 1 , use that.
you can't february version of maps api v2. best thing can to:
- have own "go location" button know when want start tracking
- your own location change listener
- a
view
on top ofsupportmapfragment
ontouchlistener
(returningfalse
!) know when need stop tracking
this solution not perfect, stop tracking before user zooms on pans - stop when first touch map, think solution not make confusion users: touched map, can expect tracking stop , can press button start it.
Comments
Post a Comment