ソースを参照

APIModuleGis 2.2.0 百度地图SDK 修改相关代码

1037015548@qq.com 6 ヶ月 前
コミット
5fe8dea0b4

+ 16 - 1
moduleGis/build.gradle

@@ -5,12 +5,23 @@ android {
     compileSdkVersion 28
     buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
 
+    sourceSets {
+        main {
+            jniLibs.srcDirs = ['libs'] // 指定 .so 文件所在的目录
+        }
+    }
+
     defaultConfig {
         minSdkVersion 19
         targetSdkVersion 28
 
         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
         consumerProguardFiles "consumer-rules.pro"
+        ndk {
+            // 设置支持的SO库架构(开发者可以根据需要,选择一个或多个平台的so)
+            abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
+//            abiFilters "armeabi", "armeabi-v7a", "arm64-v8a"
+        }
     }
 
     buildTypes {
@@ -47,10 +58,14 @@ dependencies {
     compile(name:'gnsstoollib-1.1.20230214-054100-8.0.1',ext:'aar');
     compile(name:'sdk4a-v1.6.0.3958',ext:'aar');
 
+    //百度定位SDK
+//    compile(name:'BaiduLBS_Android',ext:'aar');
+    implementation files('libs/BaiduLBS_Android.jar')
+
     //高德定位sdk
     //定位功能
     // 高德定位 SDK(检查版本号,确保为最新)
-    implementation files('libs/AMap_Location_V6.4.8_20241029.jar')
+//    implementation files('libs/AMap_Location_V6.4.8_20241029.jar')
     implementation files('libs/commons-collections4-4.4.jar')
     implementation files('libs/fastjson-1.2.83.jar')
 //    compileOnly files('../app/libs/AMap_Location_V6.4.8_20241029.jar')

+ 10 - 4
moduleGis/src/main/AndroidManifest.xml

@@ -53,10 +53,16 @@
             </intent-filter>
         </service>
         <!--高德SDK服务-->
-        <service android:name="com.amap.api.location.APSService"></service>
-        <meta-data
-            android:name="com.amap.api.v2.apikey"
-            android:value="62e295bdad10e6ed51e5bc8f26e516ef"/>
+<!--        <service android:name="com.amap.api.location.APSService"></service>-->
+<!--        <meta-data-->
+<!--            android:name="com.amap.api.v2.apikey"-->
+<!--            android:value="62e295bdad10e6ed51e5bc8f26e516ef"/>-->
+        <service android:name="com.baidu.location.f" android:enabled="true" android:process=":remote"></service>
+<!--        <meta-data-->
+<!--            android:name="com.baidu.lbsapi.API_KEY"-->
+<!--            android:value="s3s8Anc7DPaR19xw9NzeGy5Y68BEXxmp"-->
+<!--            tools:replace="android:value" >-->
+<!--        </meta-data>-->
 
     </application>
 

+ 361 - 356
moduleGis/src/main/java/com/example/moduleGis/APIModuleGis.java

@@ -28,10 +28,14 @@ import android.widget.TextView;
 import android.widget.Toast;
 
 import com.alibaba.fastjson.serializer.SerializerFeature;
-import com.amap.api.location.AMapLocation;
-import com.amap.api.location.AMapLocationClient;
-import com.amap.api.location.AMapLocationClientOption;
-import com.amap.api.location.AMapLocationListener;
+//import com.amap.api.location.AMapLocation;
+//import com.amap.api.location.AMapLocationClient;
+//import com.amap.api.location.AMapLocationClientOption;
+//import com.amap.api.location.AMapLocationListener;
+import com.baidu.location.BDAbstractLocationListener;
+import com.baidu.location.BDLocation;
+import com.baidu.location.LocationClient;
+import com.baidu.location.LocationClientOption;
 import com.example.moduleGis.gnsstest.DiffConnectManager;
 import com.example.moduleGis.gnsstest.GnssListener;
 import com.example.moduleGis.gnsstest.GnssServiceManager;
@@ -1280,358 +1284,359 @@ public class APIModuleGis extends UZModule {
 	/**
 	 * TODO 高德地图服务相关
 	 */
-	//实时定位状态码
-	public volatile static Integer amapLocationErrorCode = 0;
-	//定位堆栈, 长度不可超过10 , 超过10 则把第一个顶掉,以此类推
-	public volatile static List<AMapLocation> aMapLocations = new ArrayList<>();
-	// 向aMapLocations集合中添加对象的方法
-	public static synchronized void addLocation(AMapLocation location) {
-		if (aMapLocations.size() >= 10) {
-			// 如果长度超过10,移除第一个(即索引为0的元素)
-			aMapLocations.remove(0);
-		}
-		// 添加新的元素
-		aMapLocations.add(location);
-	}
-
-	//声明AMapLocationClient类对象
-	public AMapLocationClient mLocationClient = null;
-	//声明AMapLocationClientOption对象
-	public AMapLocationClientOption mLocationOption = null;
-	//声明定位回调监听器
-	public AMapLocationListener mLocationListener = new AMapLocationListener() {
-		@Override
-		public void onLocationChanged(AMapLocation aMapLocation) {
-			if (aMapLocation != null) {
-				int locationSize = 0;
-				Log.i("参数时间3",""+(System.currentTimeMillis()));
-				AMapZidingyiLocation result = null;
-				if (aMapLocation.getErrorCode() == 0) {
-					result = new AMapZidingyiLocation(0, System.currentTimeMillis(), aMapLocation);
-				}else{
-					result = new AMapZidingyiLocation(aMapLocation.getErrorCode(), System.currentTimeMillis(), null);
-				}
-				synchronized (LATCH_COMM){
-					lastAMapLocations.add(result);
-					locationSize = lastAMapLocations.size();
-				}
-				if (mWaitAMapSingleBack.compareAndSet(true, false)){
-					if (mLocationClient != null && locationSize >= 10){
-						mLocationClient.stopLocation();
-						mStartedAMapLocation.set(false);
-					}
-				}
-			}
-		}
-	};
-	//TODO Lx 初始化定位对象
-	public ModuleResult jsmethod_initGdMap_sync(UZModuleContext moduleContext){
-		JSONObject res = new JSONObject();
-		String code = "1";
-		String msg = "error";
-		try{
-			//TODO 合规检查
-			AMapLocationClient.updatePrivacyShow(moduleContext.getContext(),true,true);
-			AMapLocationClient.updatePrivacyAgree(moduleContext.getContext(),true);
-			//TODO 启动服务相关判断
-			res.put("code",code);
-			res.put("msg",msg);
-			if(mLocationClient != null) {
-				mLocationClient.stopLocation();
-				mLocationClient.onDestroy();
-				mInitedAMapSdk.set(false);
-				mStartedAMapLocation.set(false);
-				mWaitAMapSingleBack.set(false);
-			}
-			//初始化定位
-			mLocationClient = new AMapLocationClient(moduleContext.getContext());
-			//设置定位回调监听
-			mLocationClient.setLocationListener(mLocationListener);
-			code = "0";
-			msg = "success";
-			res.put("code",code);
-			res.put("msg",msg);
-			return new ModuleResult(res);
-		}catch(Exception ex){
-			code = "1";
-			msg = ex.getLocalizedMessage();
-			try{res.put("code",code);res.put("msg",msg);}catch(Exception e){}
-			Log.e(TAG,ex.getLocalizedMessage());
-			return new ModuleResult(res);
-		}
-	}
-
-	//TODO 高效率启动高德定位
-	private final byte[] LATCH_COMM = new byte[0];
-	AtomicBoolean mInitedAMapSdk = new AtomicBoolean(false);
-	AtomicBoolean mStartedAMapLocation = new AtomicBoolean(false);
-	AtomicBoolean mWaitAMapSingleBack = new AtomicBoolean(false);
-	class AMapZidingyiLocation{
-		int code = 1;                           //0--成功;非0--失败
-		long acceptTime = 0L;                   //接收高德定位回调的时间
-		Map<String,Object> data = null;         //高德定位结果
-
-		public AMapZidingyiLocation(){
-
-		}
-		public AMapZidingyiLocation(int code,long acceptTime,AMapLocation data){
-			this.code = code;
-			this.acceptTime = acceptTime;
-			Map<String,Object> newData = new HashMap<>();
-			if(data!=null) {
-				newData.put("latitude", data.getLatitude());//纬度
-				newData.put("longitude", data.getLongitude());//经度
-				newData.put("accurac", data.getAccuracy());//精度
-				newData.put("altitude", data.getAltitude());//海拔
-				newData.put("speed", data.getSpeed());//速度
-				newData.put("bearing", data.getBearing());//方向角
-				newData.put("buildingId", data.getBuildingId());//室内定位建筑物Id
-				newData.put("floor", data.getFloor());//室内定位楼层
-				newData.put("address", data.getAddress());//地址描述
-				newData.put("country", data.getCountry());//国家
-				newData.put("province", data.getProvince());//省份
-				newData.put("city", data.getCity());//城市
-				newData.put("district", data.getDistrict());//城区
-				newData.put("street", data.getStreet());//街道
-				newData.put("streetNum", data.getStreetNum());//街道门牌号
-				newData.put("cityCod", data.getCityCode());//城市编码
-				newData.put("adCode", data.getAdCode());//区域编码
-				newData.put("poiName", data.getPoiName());//当前位置POI名称
-				newData.put("aoiName", data.getAoiName());//当前位置所处AOI名称
-				newData.put("gpsAccuracyStatus", data.getGpsAccuracyStatus());//设备当前 GPS 状态
-				newData.put("locationType", data.getLocationType());//定位来源
-				newData.put("locationDetail", data.getLocationDetail());//定位信息描述
-				newData.put("errorInfo", data.getErrorInfo());//定位错误信息描述
-				newData.put("errorCode", data.getErrorCode());//定位错误码
-			}
-			this.data = newData;
-		}
-		public String toString(){
-			return "{\"code\":"+code+",\"acceptTime\":"+acceptTime+",\"data\":"+ (data==null?"{}": com.alibaba.fastjson.JSONObject.toJSONString(data)) +"}";
-		}
-	}
-	CircularFifoQueue<AMapZidingyiLocation> lastAMapLocations = new CircularFifoQueue<>(10);
-
-	public ModuleResult jsmethod_startAmapLocation_sync(UZModuleContext moduleContext){
-		JSONObject res = new JSONObject();
-		String code = "1";
-		String msg = "error";
-		Boolean onceFlag = moduleContext.optBoolean("onceFlag");
-		try{
-			//TODO 启动服务相关判断
-			long callTm = System.currentTimeMillis();
-			if (mInitedAMapSdk.compareAndSet(false, true)){
-				//初始化SDK参数:1) 设置连续定位; 2) 关闭缓存策略; 3) 设置连续定位间隔为1000ms; 4) 其他参数均不填使用其默认配置
-				sendAMapGis();
-			}
-
-			if ((onceFlag == null) || onceFlag || mStartedAMapLocation.compareAndSet(false, true)){
-				synchronized (LATCH_COMM){
-					lastAMapLocations.clear();
-				}
-				//调用高德SDK开始定位函数
-				if(mLocationClient != null)
-					startAMapGis(onceFlag==null?true:onceFlag);
-				mWaitAMapSingleBack.set(onceFlag==null?true:onceFlag);
-			}
-			long ff = System.currentTimeMillis();
-			//Log.i("结束参数设置时间:",""+System.currentTimeMillis());
-
-			/*do{
-				long lastAcceptTm = 0L;
-				synchronized (LATCH_COMM){
-					if (lastAMapLocations.size() > 0)
-						lastAcceptTm = lastAMapLocations.get(lastAMapLocations.size()-1).acceptTime;
-				}
-
-				Log.i("参数时间1",(System.currentTimeMillis()-ff)+"   "+lastAcceptTm);
-
-				if (lastAcceptTm >= callTm){
-					break;
-				}else{
-//					Log.i("开始睡眠时间:",""+System.currentTimeMillis());
-					try{
-						Thread.sleep(200);
-					}catch (Exception e){
-						e.printStackTrace();
-					}
-//					Log.i("结束睡眠时间:",""+System.currentTimeMillis());
-				}
-			}while(mStartedAMapLocation.get() && (System.currentTimeMillis() - callTm) <= 20000);*/
-
-			Log.i("参数时间2:",""+(System.currentTimeMillis()-ff));
-			List<String> result = new ArrayList<>();
-			synchronized (LATCH_COMM){
-				for (AMapZidingyiLocation element : lastAMapLocations){
-					result.add(0, element==null?"{}":element.toString());
-				}
-			}
-			code = "0";
-			msg = "success";
-			res.put("code",code);
-			res.put("msg",msg);
-			res.put("data", result);
-			return new ModuleResult(res);
-		}catch(Exception ex){
-			code = "1";
-			msg = ex.getLocalizedMessage();
-			try{res.put("code",code);res.put("msg",msg);}catch(Exception e){}
-			Log.e(TAG,ex.getLocalizedMessage());
-			return new ModuleResult(res);
-		}
-	}
-	public ModuleResult jsmethod_stopAmapLocation_sync(UZModuleContext moduleContext){
-		JSONObject res = new JSONObject();
-		String code = "1";
-		String msg = "error";
-		try{
-			stopAMapGis();
-			code = "0";
-			msg = "success";
-			res.put("code",code);
-			res.put("msg",msg);
-			return new ModuleResult(res);
-		}catch(Exception ex){
-			code = "1";
-			msg = ex.getLocalizedMessage();
-			try{res.put("code",code);res.put("msg",msg);}catch(Exception e){}
-			Log.e(TAG,ex.getLocalizedMessage());
-			return new ModuleResult(res);
-		}
-	}
-
-
-	public ModuleResult jsmethod_getLocationList_sync(UZModuleContext moduleContext){
-		JSONObject res = new JSONObject();
-		String code = "1";
-		String msg = "error";
-		try{
-			code = "0";
-			msg = "success";
-			res.put("code",code);
-			res.put("msg",msg);
-			List<String> result = new ArrayList<>();
-			synchronized (LATCH_COMM){
-				for (AMapZidingyiLocation element : lastAMapLocations){
-					result.add(0, element.toString()/*com.qx.wz.external.fastjson.JSONObject.toJSONString(element)*/);
-				}
-			}
-			res.put("data",result);
-			return new ModuleResult(res);
-		}catch(Exception ex){
-			code = "1";
-			msg = ex.getLocalizedMessage();
-			try{res.put("code",code);res.put("msg",msg);}catch(Exception e){}
-			Log.e(TAG,ex.getLocalizedMessage());
-			return new ModuleResult(res);
-		}
-	}
-
-	public ModuleResult sendAMapGis(){
-		JSONObject res = new JSONObject();
-		String code = "1";
-		String msg = "error";
-		try{
-			//TODO 启动服务相关判断
-			res.put("code",code);
-			res.put("msg",msg);
-			//初始化AMapLocationClientOption对象
-			mLocationOption = new AMapLocationClientOption();
-			AMapLocationClientOption option = new AMapLocationClientOption();
-			/**
-			 * 设置定位场景,目前支持三种场景(签到、出行、运动,默认无场景)
-			 */
-			option.setLocationPurpose(AMapLocationClientOption.AMapLocationPurpose.SignIn);
-			if(null != mLocationClient){
-				mLocationClient.setLocationOption(option);
-				//设置场景模式后最好调用一次stop,再调用start以保证场景模式生效
+//	//实时定位状态码
+//	public volatile static Integer amapLocationErrorCode = 0;
+//	//定位堆栈, 长度不可超过10 , 超过10 则把第一个顶掉,以此类推
+//	public volatile static List<AMapLocation> aMapLocations = new ArrayList<>();
+//	// 向aMapLocations集合中添加对象的方法
+//	public static synchronized void addLocation(AMapLocation location) {
+//		if (aMapLocations.size() >= 10) {
+//			// 如果长度超过10,移除第一个(即索引为0的元素)
+//			aMapLocations.remove(0);
+//		}
+//		// 添加新的元素
+//		aMapLocations.add(location);
+//	}
+//
+//	//声明AMapLocationClient类对象
+//	public AMapLocationClient mLocationClient = null;
+//	//声明AMapLocationClientOption对象
+//	public AMapLocationClientOption mLocationOption = null;
+//	//声明定位回调监听器
+//	public AMapLocationListener mLocationListener = new AMapLocationListener() {
+//		@Override
+//		public void onLocationChanged(AMapLocation aMapLocation) {
+//			if (aMapLocation != null) {
+//				int locationSize = 0;
+//				Log.i("参数时间3",""+(System.currentTimeMillis()));
+//				AMapZidingyiLocation result = null;
+//				if (aMapLocation.getErrorCode() == 0) {
+//					result = new AMapZidingyiLocation(0, System.currentTimeMillis(), aMapLocation);
+//				}else{
+//					result = new AMapZidingyiLocation(aMapLocation.getErrorCode(), System.currentTimeMillis(), null);
+//				}
+//				synchronized (LATCH_COMM){
+//					lastAMapLocations.add(result);
+//					locationSize = lastAMapLocations.size();
+//				}
+//				if (mWaitAMapSingleBack.compareAndSet(true, false)){
+//					if (mLocationClient != null && locationSize >= 10){
+//						mLocationClient.stopLocation();
+//						mStartedAMapLocation.set(false);
+//					}
+//				}
+//			}
+//		}
+//	};
+//	//TODO Lx 初始化定位对象
+//	public ModuleResult jsmethod_initGdMap_sync(UZModuleContext moduleContext){
+//		JSONObject res = new JSONObject();
+//		String code = "1";
+//		String msg = "error";
+//		try{
+//			//TODO 合规检查
+//			AMapLocationClient.updatePrivacyShow(moduleContext.getContext(),true,true);
+//			AMapLocationClient.updatePrivacyAgree(moduleContext.getContext(),true);
+//			//TODO 启动服务相关判断
+//			res.put("code",code);
+//			res.put("msg",msg);
+//			if(mLocationClient != null) {
+//				mLocationClient.stopLocation();
+//				mLocationClient.onDestroy();
+//				mInitedAMapSdk.set(false);
+//				mStartedAMapLocation.set(false);
+//				mWaitAMapSingleBack.set(false);
+//			}
+//			//初始化定位
+//			mLocationClient = new AMapLocationClient(moduleContext.getContext());
+//			//设置定位回调监听
+//			mLocationClient.setLocationListener(mLocationListener);
+//			code = "0";
+//			msg = "success";
+//			res.put("code",code);
+//			res.put("msg",msg);
+//			return new ModuleResult(res);
+//		}catch(Exception ex){
+//			code = "1";
+//			msg = ex.getLocalizedMessage();
+//			try{res.put("code",code);res.put("msg",msg);}catch(Exception e){}
+//			Log.e(TAG,ex.getLocalizedMessage());
+//			return new ModuleResult(res);
+//		}
+//	}
+//
+//	//TODO 高效率启动高德定位
+//	private final byte[] LATCH_COMM = new byte[0];
+//	AtomicBoolean mInitedAMapSdk = new AtomicBoolean(false);
+//	AtomicBoolean mStartedAMapLocation = new AtomicBoolean(false);
+//	AtomicBoolean mWaitAMapSingleBack = new AtomicBoolean(false);
+//	class AMapZidingyiLocation{
+//		int code = 1;                           //0--成功;非0--失败
+//		long acceptTime = 0L;                   //接收高德定位回调的时间
+//		Map<String,Object> data = null;         //高德定位结果
+//
+//		public AMapZidingyiLocation(){
+//
+//		}
+//		public AMapZidingyiLocation(int code,long acceptTime,AMapLocation data){
+//			this.code = code;
+//			this.acceptTime = acceptTime;
+//			Map<String,Object> newData = new HashMap<>();
+//			if(data!=null) {
+//				newData.put("latitude", data.getLatitude());//纬度
+//				newData.put("longitude", data.getLongitude());//经度
+//				newData.put("accurac", data.getAccuracy());//精度
+//				newData.put("altitude", data.getAltitude());//海拔
+//				newData.put("speed", data.getSpeed());//速度
+//				newData.put("bearing", data.getBearing());//方向角
+//				newData.put("buildingId", data.getBuildingId());//室内定位建筑物Id
+//				newData.put("floor", data.getFloor());//室内定位楼层
+//				newData.put("address", data.getAddress());//地址描述
+//				newData.put("country", data.getCountry());//国家
+//				newData.put("province", data.getProvince());//省份
+//				newData.put("city", data.getCity());//城市
+//				newData.put("district", data.getDistrict());//城区
+//				newData.put("street", data.getStreet());//街道
+//				newData.put("streetNum", data.getStreetNum());//街道门牌号
+//				newData.put("cityCod", data.getCityCode());//城市编码
+//				newData.put("adCode", data.getAdCode());//区域编码
+//				newData.put("poiName", data.getPoiName());//当前位置POI名称
+//				newData.put("aoiName", data.getAoiName());//当前位置所处AOI名称
+//				newData.put("gpsAccuracyStatus", data.getGpsAccuracyStatus());//设备当前 GPS 状态
+//				newData.put("locationType", data.getLocationType());//定位来源
+//				newData.put("locationDetail", data.getLocationDetail());//定位信息描述
+//				newData.put("errorInfo", data.getErrorInfo());//定位错误信息描述
+//				newData.put("errorCode", data.getErrorCode());//定位错误码
+//			}
+//			this.data = newData;
+//		}
+//		public String toString(){
+//			return "{\"code\":"+code+",\"acceptTime\":"+acceptTime+",\"data\":"+ (data==null?"{}": com.alibaba.fastjson.JSONObject.toJSONString(data)) +"}";
+//		}
+//	}
+//	CircularFifoQueue<AMapZidingyiLocation> lastAMapLocations = new CircularFifoQueue<>(10);
+//
+//	public ModuleResult jsmethod_startAmapLocation_sync(UZModuleContext moduleContext){
+//		JSONObject res = new JSONObject();
+//		String code = "1";
+//		String msg = "error";
+//		Boolean onceFlag = moduleContext.optBoolean("onceFlag");
+//		try{
+//			//TODO 启动服务相关判断
+//			long callTm = System.currentTimeMillis();
+//			if (mInitedAMapSdk.compareAndSet(false, true)){
+//				//初始化SDK参数:1) 设置连续定位; 2) 关闭缓存策略; 3) 设置连续定位间隔为1000ms; 4) 其他参数均不填使用其默认配置
+//				sendAMapGis();
+//			}
+//
+//			if ((onceFlag == null) || onceFlag || mStartedAMapLocation.compareAndSet(false, true)){
+//				synchronized (LATCH_COMM){
+//					lastAMapLocations.clear();
+//				}
+//				//调用高德SDK开始定位函数
+//				if(mLocationClient != null)
+//					startAMapGis(onceFlag==null?true:onceFlag);
+//				mWaitAMapSingleBack.set(onceFlag==null?true:onceFlag);
+//			}
+//			long ff = System.currentTimeMillis();
+//			//Log.i("结束参数设置时间:",""+System.currentTimeMillis());
+//
+//			/*do{
+//				long lastAcceptTm = 0L;
+//				synchronized (LATCH_COMM){
+//					if (lastAMapLocations.size() > 0)
+//						lastAcceptTm = lastAMapLocations.get(lastAMapLocations.size()-1).acceptTime;
+//				}
+//
+//				Log.i("参数时间1",(System.currentTimeMillis()-ff)+"   "+lastAcceptTm);
+//
+//				if (lastAcceptTm >= callTm){
+//					break;
+//				}else{
+////					Log.i("开始睡眠时间:",""+System.currentTimeMillis());
+//					try{
+//						Thread.sleep(200);
+//					}catch (Exception e){
+//						e.printStackTrace();
+//					}
+////					Log.i("结束睡眠时间:",""+System.currentTimeMillis());
+//				}
+//			}while(mStartedAMapLocation.get() && (System.currentTimeMillis() - callTm) <= 20000);*/
+//
+//			Log.i("参数时间2:",""+(System.currentTimeMillis()-ff));
+//			List<String> result = new ArrayList<>();
+//			synchronized (LATCH_COMM){
+//				for (AMapZidingyiLocation element : lastAMapLocations){
+//					result.add(0, element==null?"{}":element.toString());
+//				}
+//			}
+//			code = "0";
+//			msg = "success";
+//			res.put("code",code);
+//			res.put("msg",msg);
+//			res.put("data", result);
+//			return new ModuleResult(res);
+//		}catch(Exception ex){
+//			code = "1";
+//			msg = ex.getLocalizedMessage();
+//			try{res.put("code",code);res.put("msg",msg);}catch(Exception e){}
+//			Log.e(TAG,ex.getLocalizedMessage());
+//			return new ModuleResult(res);
+//		}
+//	}
+//	public ModuleResult jsmethod_stopAmapLocation_sync(UZModuleContext moduleContext){
+//		JSONObject res = new JSONObject();
+//		String code = "1";
+//		String msg = "error";
+//		try{
+//			stopAMapGis();
+//			code = "0";
+//			msg = "success";
+//			res.put("code",code);
+//			res.put("msg",msg);
+//			return new ModuleResult(res);
+//		}catch(Exception ex){
+//			code = "1";
+//			msg = ex.getLocalizedMessage();
+//			try{res.put("code",code);res.put("msg",msg);}catch(Exception e){}
+//			Log.e(TAG,ex.getLocalizedMessage());
+//			return new ModuleResult(res);
+//		}
+//	}
+//
+//
+//	public ModuleResult jsmethod_getLocationList_sync(UZModuleContext moduleContext){
+//		JSONObject res = new JSONObject();
+//		String code = "1";
+//		String msg = "error";
+//		try{
+//			code = "0";
+//			msg = "success";
+//			res.put("code",code);
+//			res.put("msg",msg);
+//			List<String> result = new ArrayList<>();
+//			synchronized (LATCH_COMM){
+//				for (AMapZidingyiLocation element : lastAMapLocations){
+//					result.add(0, element.toString()/*com.qx.wz.external.fastjson.JSONObject.toJSONString(element)*/);
+//				}
+//			}
+//			res.put("data",result);
+//			return new ModuleResult(res);
+//		}catch(Exception ex){
+//			code = "1";
+//			msg = ex.getLocalizedMessage();
+//			try{res.put("code",code);res.put("msg",msg);}catch(Exception e){}
+//			Log.e(TAG,ex.getLocalizedMessage());
+//			return new ModuleResult(res);
+//		}
+//	}
+//
+//	public ModuleResult sendAMapGis(){
+//		JSONObject res = new JSONObject();
+//		String code = "1";
+//		String msg = "error";
+//		try{
+//			//TODO 启动服务相关判断
+//			res.put("code",code);
+//			res.put("msg",msg);
+//			//初始化AMapLocationClientOption对象
+//			mLocationOption = new AMapLocationClientOption();
+//			AMapLocationClientOption option = new AMapLocationClientOption();
+//			/**
+//			 * 设置定位场景,目前支持三种场景(签到、出行、运动,默认无场景)
+//			 */
+//			option.setLocationPurpose(AMapLocationClientOption.AMapLocationPurpose.SignIn);
+//			if(null != mLocationClient){
+//				mLocationClient.setLocationOption(option);
+//				//设置场景模式后最好调用一次stop,再调用start以保证场景模式生效
+////				mLocationClient.stopLocation();
+////				mLocationClient.startLocation();
+//
+//				//设置定位模式为AMapLocationMode.Hight_Accuracy,高精度模式。
+//				mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
+//
+//				//单位是毫秒,默认30000毫秒,建议超时时间不要低于8000毫秒。
+//				mLocationOption.setHttpTimeOut(8000);
+//
+//				//关闭缓存机制
+//				mLocationOption.setLocationCacheEnable(false);
+//
+//
+//				//给定位客户端对象设置定位参数
+//				mLocationClient.setLocationOption(mLocationOption);
+//
+//				code = "0";
+//				msg = "success";
+//				res.put("code",code);
+//				res.put("msg",msg);
+//			}
+//
+//			return new ModuleResult(res);
+//		}catch(Exception ex){
+//			code = "1";
+//			msg = ex.getLocalizedMessage();
+//			try{res.put("code",code);res.put("msg",msg);}catch(Exception e){}
+//			Log.e(TAG,ex.getLocalizedMessage());
+//			return new ModuleResult(res);
+//		}
+//	}
+//	public ModuleResult startAMapGis(boolean onceFlag) {
+//		JSONObject res = new JSONObject();
+//		String code = "1";
+//		String msg = "error";
+//		try {
+//			code = "0";
+//			msg = "success";
+//			res.put("code",code);
+//			res.put("msg",msg);
+//			if(onceFlag){
+//				mStartedAMapLocation.set(true);
+//				mLocationOption.setOnceLocation(true);
 //				mLocationClient.stopLocation();
 //				mLocationClient.startLocation();
-
-				//设置定位模式为AMapLocationMode.Hight_Accuracy,高精度模式。
-				mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
-
-				//单位是毫秒,默认30000毫秒,建议超时时间不要低于8000毫秒。
-				mLocationOption.setHttpTimeOut(8000);
-
-				//关闭缓存机制
-				mLocationOption.setLocationCacheEnable(false);
-
-
-				//给定位客户端对象设置定位参数
-				mLocationClient.setLocationOption(mLocationOption);
-
-				code = "0";
-				msg = "success";
-				res.put("code",code);
-				res.put("msg",msg);
-			}
-
-			return new ModuleResult(res);
-		}catch(Exception ex){
-			code = "1";
-			msg = ex.getLocalizedMessage();
-			try{res.put("code",code);res.put("msg",msg);}catch(Exception e){}
-			Log.e(TAG,ex.getLocalizedMessage());
-			return new ModuleResult(res);
-		}
-	}
-	public ModuleResult startAMapGis(boolean onceFlag) {
-		JSONObject res = new JSONObject();
-		String code = "1";
-		String msg = "error";
-		try {
-			code = "0";
-			msg = "success";
-			res.put("code",code);
-			res.put("msg",msg);
-			if(onceFlag){
-				mStartedAMapLocation.set(true);
-				mLocationOption.setOnceLocation(true);
-				mLocationClient.stopLocation();
-				mLocationClient.startLocation();
-			}else {
-				//设置定位间隔,单位毫秒,默认为2000ms,最低1000ms。
-				mLocationOption.setInterval(1000);
-				mLocationClient.stopLocation();
-				//启动定位
-				mLocationClient.startLocation();
-			}
-			return new ModuleResult(res);
-		}catch(Exception ex){
-			code = "1";
-			msg = ex.getLocalizedMessage();
-			try{res.put("code",code);res.put("msg",msg);}catch(Exception e){}
-			Log.e(TAG,ex.getLocalizedMessage());
-			return new ModuleResult(res);
-		}
-	}
-	public ModuleResult stopAMapGis(){
-		JSONObject res = new JSONObject();
-		String code = "1";
-		String msg = "error";
-		try{
-			//TODO 启动服务相关判断
-			res.put("code",code);
-			res.put("msg",msg);
-			mLocationClient.stopLocation();//停止定位后,本地定位服务并不会被销毁
-			mStartedAMapLocation.set(false);
-			mWaitAMapSingleBack.set(false);
-			code = "0";
-			msg = "success";
-			res.put("code",code);
-			res.put("msg",msg);
-			return new ModuleResult(res);
-		}catch(Exception ex){
-			code = "1";
-			msg = ex.getLocalizedMessage();
-			try{res.put("code",code);res.put("msg",msg);}catch(Exception e){}
-			Log.e(TAG,ex.getLocalizedMessage());
-			return new ModuleResult(res);
-		}
-	}
+//			}else {
+//				//设置定位间隔,单位毫秒,默认为2000ms,最低1000ms。
+//				mLocationOption.setInterval(1000);
+//				mLocationClient.stopLocation();
+//				//启动定位
+//				mLocationClient.startLocation();
+//			}
+//			return new ModuleResult(res);
+//		}catch(Exception ex){
+//			code = "1";
+//			msg = ex.getLocalizedMessage();
+//			try{res.put("code",code);res.put("msg",msg);}catch(Exception e){}
+//			Log.e(TAG,ex.getLocalizedMessage());
+//			return new ModuleResult(res);
+//		}
+//	}
+//	public ModuleResult stopAMapGis(){
+//		JSONObject res = new JSONObject();
+//		String code = "1";
+//		String msg = "error";
+//		try{
+//			//TODO 启动服务相关判断
+//			res.put("code",code);
+//			res.put("msg",msg);
+//			mLocationClient.stopLocation();//停止定位后,本地定位服务并不会被销毁
+//			mStartedAMapLocation.set(false);
+//			mWaitAMapSingleBack.set(false);
+//			code = "0";
+//			msg = "success";
+//			res.put("code",code);
+//			res.put("msg",msg);
+//			return new ModuleResult(res);
+//		}catch(Exception ex){
+//			code = "1";
+//			msg = ex.getLocalizedMessage();
+//			try{res.put("code",code);res.put("msg",msg);}catch(Exception e){}
+//			Log.e(TAG,ex.getLocalizedMessage());
+//			return new ModuleResult(res);
+//		}
+//	}
 
 	///////////////////////以下为百度定位//////////////////////
+	private final byte[] LATCH_COMM = new byte[0];
 	class BMapLocationResult{
 		int code = 1;                           //0--成功;非0--失败
 		long acceptTime = 0L;                   //接收高德定位回调的时间
@@ -1685,7 +1690,7 @@ public class APIModuleGis extends UZModule {
 				}
 				if (mWaitBMapSingleBack.compareAndSet(true, false)){
 					if (mBMapClient != null && locationSize >= 10){
-						mBMapClient.stop();
+//						mBMapClient.stop();
 					}
 				}
 			}
@@ -1702,7 +1707,7 @@ public class APIModuleGis extends UZModule {
 		}
 	};
 
-	public void initBMapFun(UZModuleContext moduleContext){
+	public void initBMapFun(UZModuleContext moduleContext) throws Exception{
 		if (mBMapClient != null) {
 			mBMapClient.stop();
 
@@ -1723,7 +1728,7 @@ public class APIModuleGis extends UZModule {
 		mBMapOption.setIgnoreKillProcess(true);
 		mBMapOption.setIsNeedLocationPoiList(false);
 		mBMapOption.SetIgnoreCacheException(false);
-		mBMapOption.setLocationMode(LocationMode.Hight_Accuracy);
+		mBMapOption.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);
 		mBMapOption.setIsNeedAltitude(false);
 		mBMapOption.setFirstLocType(LocationClientOption.FirstLocType.SPEED_IN_FIRST_LOC);
 		mBMapOption.setOpenGnss(true);
@@ -1743,7 +1748,7 @@ public class APIModuleGis extends UZModule {
 			mBMapOption.setScanSpan(0);
 			mBMapOption.setLocationNotify(false);
 			mBMapOption.setWifiCacheTimeOut(10000);
-			mBMapOption.setFirstLocType(LocationClientOption.FirstLocType.ACCUARACY_IN_FIRST_LOC);
+			mBMapOption.setFirstLocType(LocationClientOption.FirstLocType.ACCURACY_IN_FIRST_LOC);
 
 			mBMapClient.stop();
 			mBMapClient.setLocOption(mBMapOption);