我最近在开发一款应用,我需要在 Google map 上显示用户的位置。
根据我在网上找到的资料,借助API。 现在我可以显示手机的位置并进行标记。
目前我使用下面的代码获取位置
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);
}
我猜这个方法会每秒调用一次onLocationChanged(Location location)
方法?
事实证明,该位置每 15 秒检测一次。但我需要尽快更新位置信息。
最佳答案
使用 GPS_PROVIDER
关于android - 如何在 Android 的 Google map 上快速更新用户的位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7978528/