Commit aa4d5f7c by cuiliang.shi

15次 取最佳精度

1 parent 7f8c53bf
...@@ -114,6 +114,7 @@ public class BirdService extends Service { ...@@ -114,6 +114,7 @@ public class BirdService extends Service {
}; };
private int mLocationCount = 0; private int mLocationCount = 0;
private float mAccuracy = 10000;
public AMapLocationListener mLocationListener = new AMapLocationListener() { public AMapLocationListener mLocationListener = new AMapLocationListener() {
@Override @Override
...@@ -127,12 +128,19 @@ public class BirdService extends Service { ...@@ -127,12 +128,19 @@ public class BirdService extends Service {
+ ", amapLocation.getAccuracy():"+amapLocation.getAccuracy() + ", amapLocation.getAccuracy():"+amapLocation.getAccuracy()
+"amapLocation.getLocationType()" + amapLocation.getLocationType()); +"amapLocation.getLocationType()" + amapLocation.getLocationType());
if (mLocationCount > 4){ if (amapLocation.getAccuracy() < mAccuracy){
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); mAccuracy = amapLocation.getAccuracy();
mStartTime = dateformat.format(System.currentTimeMillis());
mLatitude = String.valueOf(amapLocation.getLatitude()); mLatitude = String.valueOf(amapLocation.getLatitude());
mLongitude = String.valueOf(amapLocation.getLongitude()); mLongitude = String.valueOf(amapLocation.getLongitude());
}
if (mLocationCount > 15){
Log.d(TAG, "LAST PERFECT INFO amapLocation.getLatitude(): " + mLatitude
+ ", amapLocation.getLongitude(): " + mLongitude
+ ", amapLocation.getAccuracy():" + mAccuracy);
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
mStartTime = dateformat.format(System.currentTimeMillis());
if (mLocationClient != null) { if (mLocationClient != null) {
mLocationClient.stopLocation(); mLocationClient.stopLocation();
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!