android - Google Map V21, how to programatically stop the automatic location updates? -


hello using support map fragment android map. other using default settings (no customisation), noticed out of box map seems provide location updates automatically i.e. dot on map tells user , periodically updates.

my map fragment apart of layout whereby map fragment visibility can set gone , other content shown in place.

my question is, how programmatically stop these location updates? noticed when activity hosts map fragment goes in stop state, location updates stop.

this behaviour want mimic when visibility of fragment changes.

in xml

<fragment             android:id="@+id/map"             android:layout_width="match_parent"             android:layout_height="match_parent"             class="com.google.android.gms.maps.supportmapfragment" /> 

initialised in code

 supportmapfragment mapfragment = ((supportmapfragment) getchildfragmentmanager().findfragmentbyid(r.id.map));  mapfragment.getmapasync(this); 

some settings set in onmapready callback

 mgooglemap.setmylocationenabled(true);         mgooglemap.setmaptype(googlemap.map_type_normal);         mgooglemap.getuisettings().setzoomcontrolsenabled(false);         mgooglemap.setonmylocationbuttonclicklistener(this);         mgooglemap.setonmarkerclicklistener(this); 

try code

mgooglemap.setmylocationenabled(false);  

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -