alvan alvan - 1 month ago 5
Android Question

How can I update user's position quickly on Google Map in Android?

I am working on an app recently, and I need to show user's position on the Google Map.

According to the material I found on the internet and with the help of API.
Now I can show the phone's position and mark it.

Currently I use the code below to obtain the location

locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000,0, this);
........
public void onLocationChanged(Location location) {
if(location!=null){
currentLocation = location;

GeoPoint geo = new GeoPoint(((int)location.getLatitude()*1E6),
((int)location.getLongitude()*1E6))
System.err.println("onLocationChanged"+geo.toString());
mapController.animateTo(geo);
}


I guess this method would call the
onLocationChanged(Location location)
method every second?

It turns out, the location is detected every 15 sec. But I need to update the location information ASAP.

Answer

Use the GPS_PROVIDER