Where do I find the android sdk to allow gps in realtime. Like the ESRI app where the gps move with you.
If you are building a map with the MapView from the ArcGIS Runtime SDK for Android, then you can use the LocationDisplayManager to set the map to automatically pan in navigation mode. See the LocationDisplayManager class: use the setAutoPan method and set the mode as NAVIGATION, and use the start method to start the auto-panning behaviour. There are differerent auto-pan modes - see the Nearby Sample for an example of using the LOCATION mode in an app.
Thanks Shelly,
I checked isStarted() and it showed "true". Checked GetAutoPanMode(), it showed from NAVIGATION to OFF. The reason it went from NAVIGATION to OFF is because perhaps I zoomed to the GPS location after the map initialized. I have to zoom it because otherwise it only displays the world map from out of space view, which not really helping. Is there a way to setAutoPanMode from OFF back to NAVIGATION? Why autoPanMode not zooming to the GPS location automatically?
Thanks,
Thom
If you're seeing the GPS updates on the map, first thing I would check is that you're not touching the map at all after the auto-pan is set - auto-panning is automatically turned off if the user interacts with the map and changes the extent manually (zooming or panning) or if the extent is changed programmatically - check getAutoPanMode(), and also worth checking that the location updates started correctly, using isStarted().
I followed LocationDisplayManager API, and it's still not working. My partial code is below
LocationDisplayManager ldm = mMapView.getLocationDisplayManager();
ldm.setAutoPanMode(AutoPanMode.NAVIGATION
ls.start();
What it does is even it shows the GPS moving, but the map doesn't stay focus (center) on the GPS, hence, the GPS will eventually move off the map. What I did to temporarily fix this is to implement LocationListener, onLocationChanged(Location loc) and have to set the map to zoom at location's longitude/latitude all the time, but performance wise is not very good.
ldm = mMapView.getLocationDisplayManager(); ldm.setAutoPanMode(AutoPanMode.LOCATION); ldm.setLocationListener(new LocationListener(){
@Override
public void onLocationChanged(Location loc) { if (loc == null) return; if (isMapFocus) { mapOption = new MapOptions(MapType.TOPO, loc.getLatitude(), loc.getLongitude(), 17); mMapView.setMapOptions(mapOption); }
}
});
Is there any sample that exactly does this?
thanks a lot,
Thanks for the advice.
Thanks , i'll give it a shot. Your the Best!
The Android SDK
Location-based applications are now commonplace, but due to the less than optimal accuracy, user movement, the multitude of methods to obtain the location
String locationProvider = LocationManager.NETWORK_PROVIDER; // Or, use GPS location data: // String locationProvider = LocationManager.GPS_PROVIDER; locationManager.requestLocationUpdates(locationProvider, 0, 0, locationListener);
Location Strategies | Android Developers
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.