Appearance
高德地图获取定位 MideaMap
介绍
使用高德地图原生 SDK 获取定位
目录
单次定位
接口名称
location
示例代码
js
cordova.exec(
(success) => {
console.log("成功的回调函数");
console.log(success);
},
(err) => {
console.log("失败的回调函数_", err);
},
"MideaMap",
"location",
["1", "Kilometer", 0, "0"]
);
API
入参
| 参数 | 类型 | 说明 |
|---|---|---|
| needReGeocode | string | 是否开启逆地理编码 1 :开启;0 :关闭` |
| argAccuracy | string | 逆地理编码精准度 ThreeKilometers :3000 米;Kilometer :1000 米;HundredMeters :100 米;NearestTenMeters: 20 米;BestForNavigation: 5 米 |
| locationMode | int | 定位模式 0 高精度模式;1GPS 定位;2 低功耗 |
string | 废旧参数:传0占位或不传 经纬度是否转换,0不转,1转 WGS-84,2百度坐标 BD-09 |
出参
- 成功返回 JSON 数据
| 参数 | 类型 | 说明 |
|---|---|---|
| latitude | number | 纬度 |
| longitude | number | 经度 |
| addrStr | string | 详细地址字符串 |
| address | string | 完整地址 |
| province | string | 省份 |
| city | string | 城市名称 |
| district | string | 区 |
| street | string | 街道 |
| cityCode | string | 城市编码 |
| adCode | string | 区域编码 |
| streetNum | string | 门牌号 |
| timestamp | number | 时间戳 |
| locationType | number | android 参数,非必须,定位的来源:0 定位失败/1GPS 定位结果/2 前次定位结果 |
| GpsAccuracyStatus | number | android 参数,非必须,定位 gps 状态 |
- 失败返回:
string文本说明
持续定位
接口名称
startSerialLocation
示例代码
js
cordova.exec(
(success) => {
console.log("成功的回调函数");
console.log(success);
},
(err) => {
console.log("失败的回调函数_", err);
},
"MideaMap",
"startSerialLocation",
[true, 2000, 0]
);
API
入参
| 参数 | 类型 | 说明 |
|---|---|---|
| needAddress | boolean | 是否开启逆地理编码 true :开启;false :关闭` |
| interval | long | 定位频率 单位毫秒,默认 2000ms |
| locationMode | int | 定位模式 0 高精度模式;1GPS 定位;2 低功耗 |
出参
- 成功返回
| 参数 | 类型 | 说明 |
|---|---|---|
| latitude | number | 纬度 |
| longitude | number | 经度 |
| addrStr | string | 详细地址字符串 |
| address | string | 完整地址 |
| province | string | 省份 |
| city | string | 城市名称 |
| district | string | 区 |
| street | string | 街道 |
| cityCode | string | 城市编码 |
| adCode | string | 区域编码 |
| streetNum | string | 门牌号 |
| timestamp | number | 时间戳 |
| locationType | number | android 参数,非必须,定位的来源:0 定位失败/1GPS 定位结果/2 前次定位结果 |
| GpsAccuracyStatus | number | android 参数,非必须,定位 gps 状态 |
- 失败返回:
string文本说明
关闭持续定位
接口名称
stopSerialLocation
示例代码
js
window.cordova.exec(
(data) => {
console.log("成功", data);
},
(err) => {
console.log("失败", err);
},
"MideaMap",
"stopSerialLocation",
[]
);
API
入参
| 参数 | 必传 | 说明 | 类型 | 默认值 |
|---|
出参
| 参数 | 类型 | 说明 |
|---|