请问一下,标准基座下用的是高德地图,getLocation获取的坐标是准确的。
但是使用自定义基座以后,坐标就偏离了。
可是在工程配置manifest.json中,并没有选择百度或者高德的SDK。
这个问题要怎么解决呢?
(使用自定义基座的原因是,自己集成的一个插件包含了第三方的aar文件且其中有高德的jar包)
===================以下是各种打包方式的测试结果(GCJ02,WGS84)
其中标准基座给出的定位信息是准确的,自定义基座还有UniPlugin-Hello-AS样例工程,坐标均不准确。
高德地图坐标拾取:中为物流
102.652819,25.07791
标准基座:
{
"type": "GCJ02",
"altitude": 0,
"latitude": 25.077684,
"longitude": 102.65359,
"speed": 0,
"accuracy": 550,
"address": {
"country": "中国",
"province": "云南省",
"city": "昆明市",
"district": "五华区",
"street": "科开路",
"streetNum": "313号",
"poiName": "星星艺术培训中心",
"cityCode": "0871"
},
"errMsg": "getLocation:ok"
}
{
"type": "WGS84",
"altitude": 0,
"latitude": 25.077684,
"longitude": 102.65359,
"speed": 0,
"accuracy": 550,
"address": {
"country": "中国",
"province": "云南省",
"city": "昆明市",
"district": "五华区",
"street": "科开路",
"streetNum": "313号",
"poiName": "星星艺术培训中心",
"cityCode": "0871"
},
"errMsg": "getLocation:ok"
}
自定义基座:
{
"type": "GCJ02",
"altitude": 0,
"latitude": 25.080925,
"longitude": 102.651389,
"speed": 0,
"accuracy": 39,
"errMsg": "getLocation:ok"
}
{
"type": "WGS84",
"altitude": 0,
"latitude": 25.080925,
"longitude": 102.651389,
"speed": 0,
"accuracy": 39,
"errMsg": "getLocation:ok"
}
Android studio debug运行(UniPlugin-Hello-AS样例工程):
{
"type": "GCJ02",
"altitude": 0,
"latitude": 25.080933,
"longitude": 102.651395,
"speed": 0,
"accuracy": 41,
"errMsg": "getLocation:ok"
}
{
"type": "WGS84",
"altitude": 0,
"latitude": 25.080933,
"longitude": 102.651395,
"speed": 0,
"accuracy": 41,
"errMsg": "getLocation:ok"
}
===================插件配置如下(原生插件和第三方包详见附件)
{
"name": "DriverPositionModule",
"id": "DriverPositionModule",
"version": "1.0.0",
"description": "驾驶员位置信息",
"_dp_type":"nativeplugin",
"_dp_nativeplugin":{
"android": {
"plugins": [
{
"type": "module",
"name": "DriverPositionModule",
"class": "com.zwwl.uniplugin_driver.DriverPositionModule"
}
],
"integrateType": "aar",
"dependencies": [
"com.lzy.net:okgo:3.0.4",
"org.bouncycastle:bcprov-jdk15on:1.47"
],
"minSdkVersion" : 16,
"parameters": {
"apikey": {
"des": "****",
"key": "com.amap.api.v2.apikey"
}
}
}
}
}
===================在android studio中原生插件的打包配置如下(locationsdk-1.0.0.aar包放在插件libs下)
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
compileOnly fileTree(dir: 'libs', include: ['*.jar'])
// begin - uni app
compileOnly fileTree(dir: '../app/libs', include: ['uniapp-release.aar'])
compileOnly "com.android.support:recyclerview-v7:28.0.0"
compileOnly "com.android.support:support-v4:28.0.0"
compileOnly "com.android.support:appcompat-v7:28.0.0"
compileOnly 'com.alibaba:fastjson:1.1.46.android'
// end - uni app
// begin - 上传位置信息依赖
compileOnly 'com.lzy.net:okgo:3.0.4'
compileOnly 'org.bouncycastle:bcprov-jdk15on:1.47'
compileOnly (name:'locationsdk-1.0.0', ext:'aar')
// end - 上传位置信息依赖
}