cordova-plugin-gdlocation v1.0.47
使用高德地图进行定位
★提供的功能有:定位、导航、语音合成播报、记录移动距离、计算两坐标的距离
使用方法
- start(onceFlag, interval, callBack) 开始定位
- stop() 结束定位
- showRoute(ttsAppId, startObj, endObj) 执行导航
- stopRoute(stopReason) 停止导航
- startSpeak(ttsAppId, speekContent) 语音合成播报
- startRecord(interval, minDis, maxDis) 开始记录移动距离
- stopRecord() 停止记录移动距离
- calcNavInfo(oneLatLng, twoLatLng) 计算两坐标的距离
插件安装
$ npm install cordova-plugin-gdlocation
$ cordova plugin add cordova-plugin-gdlocation --variable API_KEY=高德地图中应用的API_KEY
方法说明
☆ start(onceFlag, interval, callBack) 开始进行定位 ●
onceFlag: Boolean
布尔值参数 表示是否为一次定位逻辑,设置为 true 表示进行一次定位请求,设置为 false 表示进行连续的定位请求 ●interval: Number
数值参数 连续定位的时间间隔,单位 毫秒,默认值 2000, 如果参数onceFlag
设置为 true,该参数无效 ●callBack: Function
回调方法 当获取到位置信息后,回调该方法,返回位置信息 ☆ stop() 结束定位 ☆ showRoute(ttsAppId, startObj, endObj) 执行导航 ●ttsAppId: String
字符串参数 导航使用的讯飞语音AppId ●startObj: JSONObject
JSON对象参数 导航的起点数据,格式为:{ startName: string, startLat: double, startLng: double } ●endObj: JSONObject
JSON对象参数 导航的终点数据,格式为:{ endName: string, endLat: double, endLng: double } ☆ stopRoute(stopReason, callBack) 停止导航 ●stopReason: String
字符串参数 停止导航的原因 ●callBack: Function
回调方法 当导航停止后,回调该方法,无信息返回 ☆ startSpeak(ttsAppId, speekContent) 语音合成播报 ●ttsAppId: String
字符串参数 语音播报使用的讯飞语音AppId ●speekContent: String
字符串参数 语音播报的文字内容 ☆ startRecord(interval, minDis, maxDis) 开始记录移动距离 ●interval: Number
数值参数 连续返回移动距离记录的时间间隔,单位 毫秒,默认值 2000 ●minDis: Float
数值参数 允许忽略掉每次移动距离的最小值 ●maxDis: Float
数值参数 允许忽略掉每次移动距离的最大值 ☆ stopRecord() 停止记录移动距离 ☆ calcNavInfo(oneLatLng, twoLatLng) 计算两坐标的距离 ●oneLatLng: JSONObject
JSON对象参数 第一个坐标点,格式为:{ lat: double, lng: double } ●twoLatLng: JSONObject
JSON对象参数 第二个坐标点,格式为:{ lat: double, lng: double }
联系作者
Email
2559635030@qq.com
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago