Hi,
I'm using
mapView.getLocationDisplay().setShowLocation(true); mapView.getLocationDisplay().setAutoPanMode(LocationDisplay.AutoPanMode.RECENTER); mapView.getLocationDisplay().startAsync(); to start the location service in my 100.2.1 Android app, andmapView.getLocationDisplay().stop(); mapView.getLocationDisplay().setShowLocation(false); mapView.getLocationDisplay().setAutoPanMode(LocationDisplay.AutoPanMode.OFF) to stop it. I stop the service every time I pause the app, and restart it only if the user clicks on the GPS button on my map. However, it sometimes happens that when I stop the Location Display, then immediately pause and resume the app, the location marker is still shown on the map (although it is no longer animated or moving). This wouldn't really bother me that much, but unfortunately, if I now click on a POI on my map, the MapView only briefly zooms to that POI (as expected), and then instantly zooms back to the location marker, even though the AutoPanMode is off and the LocationDisplay is not running! (mapView.getLocationDisplay().isStarted() = false!). The same happens occasionally if I do not pause the app, but simply switch basemaps. I.e., I stop the Location Display (the location marker disappears), switch to a new basemap, and (sometimes) see the location marker on the map again, and the map keeps zooming back to this location. Is this a bug in the API? Or what might cause this issue? Thank you, Claudia
Solved! Go to Solution.
I eventually managed to find a solution.
I changed the order of my cancellation methods to
locationDisplay.setAutoPanMode(LocationDisplay.AutoPanMode.OFF); locationDisplay.stop(); Now the map does no longer zoom to the location marker after stopping the service, which is great. I still think there is a bug in the API, though. If I also putlocationDisplay.setShowLocation(false); locationDisplay.setShowPingAnimation(false); locationDisplay.setShowAccuracy(false); BEFORE locationDisplay.stop() instead of after, it won't longer happen that there is still a static location marker on the map after cancellation. But in return, the marker doesn't immediately show up when the service is running and a new location was found. That's why I keep these three methods AFTER locationDisplay.stop(). I don't really care if sometimes the marker is still visible after stopping the LocationDisplay as long as the map does not zoom to this point.
I eventually managed to find a solution.
I changed the order of my cancellation methods to
locationDisplay.setAutoPanMode(LocationDisplay.AutoPanMode.OFF); locationDisplay.stop(); Now the map does no longer zoom to the location marker after stopping the service, which is great. I still think there is a bug in the API, though. If I also putlocationDisplay.setShowLocation(false); locationDisplay.setShowPingAnimation(false); locationDisplay.setShowAccuracy(false); BEFORE locationDisplay.stop() instead of after, it won't longer happen that there is still a static location marker on the map after cancellation. But in return, the marker doesn't immediately show up when the service is running and a new location was found. That's why I keep these three methods AFTER locationDisplay.stop(). I don't really care if sometimes the marker is still visible after stopping the LocationDisplay as long as the map does not zoom to this point.