Android谷歌地图显示旧位置
问题描述:
我们的应用程序存在与地图位置有关的问题。Android谷歌地图显示旧位置
加载地图屏幕时,地图会在屏幕上显示最后一个GPS位置,这可能不准确。有时从GPS获取更新的位置信息需要相当长的时间,并且有时会直接失败。
无论在哪种情况下,用户都会收到来自最后一个已知位置的不准确位置信息。我们应该避免这...
我们需要能够显示进度条或微调到用户,而GPS信息更新,只有然后在地图上显示新的更新位置。
我们怎样才能做到这一点,非常感谢,提前感谢。
答
覆盖OnLocationChanged方法。无论您在实施LocationListener的..
像这样: -
private class MyLocationListener implements LocationListener{
public void onLocationChanged(Location argLocation) {
GeoPoint myGeoPoint = new GeoPoint(
(int)(argLocation.getLatitude()*1000000),
(int)(argLocation.getLongitude()*1000000));
GeoPoint newGeoPoint = new GeoPoint(myGeoPoint.getLatitudeE6(), myGeoPoint.getLongitudeE6());
Toast.makeText(GetApplicationContext(),"Lat:"+newGeoPoint.getLatitudeE6()/1000000,"Lang:"+newGeoPoint.getLongitudeE6()/1000000)
}
希望它会帮助你..