|
|
@@ -128,11 +128,11 @@ public class GoogleLocationUtil {
|
|
|
}
|
|
|
|
|
|
Criteria criteria = new Criteria();
|
|
|
- criteria.setAccuracy(Criteria.ACCURACY_FINE);
|
|
|
+ criteria.setAccuracy(Criteria.ACCURACY_COARSE);
|
|
|
criteria.setAltitudeRequired(false);
|
|
|
criteria.setBearingRequired(false);
|
|
|
criteria.setCostAllowed(true);
|
|
|
- criteria.setPowerRequirement(Criteria.POWER_LOW);
|
|
|
+ criteria.setPowerRequirement(Criteria.POWER_MEDIUM);
|
|
|
String provider = locationManager.getBestProvider(criteria, true);
|
|
|
|
|
|
// LogUtils.e("nst","getLocationInfo: -----" + provider);
|
|
|
@@ -142,10 +142,11 @@ public class GoogleLocationUtil {
|
|
|
}
|
|
|
Location location = locationManager.getLastKnownLocation(provider);
|
|
|
if (location != null){
|
|
|
+ ToastUtils.showShort("getLastKnownLocation:"+location.getLatitude()+"--------"+location.getLongitude());
|
|
|
LogUtil.e("nst","getLastKnownLocation:"+location.getLatitude()+"--------"+location.getLongitude());
|
|
|
locationInfoListener.locationSuccess(location.getLatitude(),location.getLongitude());
|
|
|
}else{
|
|
|
- //如果位置移动超过200米那将会重新定位
|
|
|
+ //如果位置移动超过MIN_DISTANCE米那将会重新定位
|
|
|
locationManager.requestLocationUpdates(provider, MIN_TIME, MIN_DISTANCE,myLocationListener);
|
|
|
}
|
|
|
|
|
|
@@ -162,6 +163,7 @@ public class GoogleLocationUtil {
|
|
|
if (locationInfoListener == null)
|
|
|
return;
|
|
|
if(location != null){
|
|
|
+ ToastUtils.showShort("onLocationChanged:"+location.getLatitude()+"--------"+location.getLongitude());
|
|
|
// LogUtil.e("nst","onLocationChanged:"+location.getLatitude()+"--------"+location.getLongitude());
|
|
|
locationInfoListener.locationSuccess(location.getLatitude(),location.getLongitude());
|
|
|
}else{
|