|
@@ -1303,6 +1303,7 @@ public class APIModuleGis extends UZModule {
|
|
@Override
|
|
@Override
|
|
public void onLocationChanged(AMapLocation aMapLocation) {
|
|
public void onLocationChanged(AMapLocation aMapLocation) {
|
|
if (aMapLocation != null) {
|
|
if (aMapLocation != null) {
|
|
|
|
+ int locationSize = 0;
|
|
Log.i("参数时间3",""+(System.currentTimeMillis()));
|
|
Log.i("参数时间3",""+(System.currentTimeMillis()));
|
|
AMapZidingyiLocation result = null;
|
|
AMapZidingyiLocation result = null;
|
|
if (aMapLocation.getErrorCode() == 0) {
|
|
if (aMapLocation.getErrorCode() == 0) {
|
|
@@ -1312,11 +1313,12 @@ public class APIModuleGis extends UZModule {
|
|
}
|
|
}
|
|
synchronized (LATCH_COMM){
|
|
synchronized (LATCH_COMM){
|
|
lastAMapLocations.add(result);
|
|
lastAMapLocations.add(result);
|
|
|
|
+ locationSize = lastAMapLocations.size();
|
|
}
|
|
}
|
|
if (mWaitAMapSingleBack.compareAndSet(true, false)){
|
|
if (mWaitAMapSingleBack.compareAndSet(true, false)){
|
|
- if (mLocationClient != null){
|
|
|
|
- //mLocationClient.stopLocation();
|
|
|
|
- //mStartedAMapLocation.set(false);
|
|
|
|
|
|
+ if (mLocationClient != null && locationSize >= 10){
|
|
|
|
+ mLocationClient.stopLocation();
|
|
|
|
+ mStartedAMapLocation.set(false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1423,13 +1425,13 @@ public class APIModuleGis extends UZModule {
|
|
sendAMapGis();
|
|
sendAMapGis();
|
|
}
|
|
}
|
|
|
|
|
|
- if (onceFlag || mStartedAMapLocation.compareAndSet(false, true)){
|
|
|
|
|
|
+ if ((onceFlag == null) || onceFlag || mStartedAMapLocation.compareAndSet(false, true)){
|
|
synchronized (LATCH_COMM){
|
|
synchronized (LATCH_COMM){
|
|
lastAMapLocations.clear();
|
|
lastAMapLocations.clear();
|
|
}
|
|
}
|
|
//调用高德SDK开始定位函数
|
|
//调用高德SDK开始定位函数
|
|
if(mLocationClient != null)
|
|
if(mLocationClient != null)
|
|
- startAMapGis(onceFlag);
|
|
|
|
|
|
+ startAMapGis(onceFlag==null?true:onceFlag);
|
|
mWaitAMapSingleBack.set(onceFlag==null?true:onceFlag);
|
|
mWaitAMapSingleBack.set(onceFlag==null?true:onceFlag);
|
|
}
|
|
}
|
|
long ff = System.currentTimeMillis();
|
|
long ff = System.currentTimeMillis();
|
|
@@ -1614,6 +1616,7 @@ public class APIModuleGis extends UZModule {
|
|
res.put("msg",msg);
|
|
res.put("msg",msg);
|
|
mLocationClient.stopLocation();//停止定位后,本地定位服务并不会被销毁
|
|
mLocationClient.stopLocation();//停止定位后,本地定位服务并不会被销毁
|
|
mStartedAMapLocation.set(false);
|
|
mStartedAMapLocation.set(false);
|
|
|
|
+ mWaitAMapSingleBack.set(false);
|
|
code = "0";
|
|
code = "0";
|
|
msg = "success";
|
|
msg = "success";
|
|
res.put("code",code);
|
|
res.put("code",code);
|