aruis / cordova-plugin-baidumaplocation Goto Github PK
View Code? Open in Web Editor NEWGet device current Location from Baidu Map
Home Page: https://www.npmjs.com/package/cordova-plugin-baidumaplocation
License: Apache License 2.0
Get device current Location from Baidu Map
Home Page: https://www.npmjs.com/package/cordova-plugin-baidumaplocation
License: Apache License 2.0
你好,在安装插件时显示 UnhandledPromiseRejectionWarning: CordovaError: Variable(s) missing (use: --variable IOS_KEY=value),由于暂时只使用安卓,所以只使用了 --variable ANDROID_KEY=“<ANDROID_KEY>”,看到项目首页说明可以只提供一个参数,现在是否必须提供两个?
安装插件之后,直接写入代码 baidumap_location 提示找不到
如果手机只开了流量4G 没有开wifi 无法定位(比如在外面没有wifi的环境)
"latitude": 5e-324,
"lontitude": 5e-324,
但是我用6.2.3版本的时候是可以获取定位的,应该不是我key的问题。不明白什么原因
getCurrentPosition 函数中的 options 参数如何使用?
android 和 ios如何设置 wgs84坐标系。
你好,很感谢你提供了这样的一个定位插件,对我很有帮助!
但是我现在也遇到了定位有时返回的数据不正确的情况,这边已确认添加了KEY,我同时试了我们的KEY和您提供的DEMO里面的KEY,都出现过,请问针对这个问题有什么解决办法么?谢谢!
安装时会报找不到AndroidManifest.xml 文件!!!
npm install --save @ionic-native/<请问此处添什么?添baidumaplocation会报错哟!>
求解~
请问如何设置iOS定位返回的类型是火星坐标系,看了一下官网,是不是iOS的不支持?安卓的是可以的,如果iOS的也可以请问如何设置呢?小哥哥
版本信息:
Installed platforms:
android 6.4.0
ios 4.5.4
安装插件的时候,仔细一看,发现有问题:
Configuration 'compile' in project ':' is deprecated. Use 'implementation' instead. The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead
请问如何解决?谢谢了
baidumap_location.getCurrentPosition(function (res) {
alert(JSON.stringify(res: ${res}
));
}, function (error) {
alert(JSON.stringify(`error: ${error}`))
that.androidPermissions.requestPermissions([
that.androidPermissions.PERMISSION.ACCESS_COARSE_LOCATION,
that.androidPermissions.PERMISSION.ACCESS_FINE_LOCATION,
that.androidPermissions.PERMISSION.ACCESS_LOCATION_EXTRA_COMMANDS]).then(r => {
// 申请权限成功
baidumap_location.getCurrentPosition(function (res) {
alert(JSON.stringify(res));
});
}).catch(err => {
alert(err)
});
})
baidumap_location.getCurrentPosition
对象能获取 但是回调方法不起作用 申请了自己的百度密钥了
添加插件的时候很慢.但是最后显示
Fetching plugin "cordova-plugin-baidumaplocation" via npm
Error: Failed to fetch plugin cordova-plugin-baidumaplocation via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: shasum check failed for C:\Users\dell\AppData\Local\Temp\npm-6104-c3fd1d90\registry.npmjs.org\cordova-plugin-baidumaplocation-\cordova-plugin-baidumaplocation-2.0.2.tgz
Expected: d1f8a8c01e0a018cfd3e216aeed8e74dff31cd75
Actual: 08fa3e2f08192d081a7457d33c1f1d23890e4313
From: http://registry.npmjs.org/cordova-plugin-baidumaplocation/-/cordova-plugin-baidumaplocation-2.0.2.tgz
我申请了安卓key 浏览器key ios key,都 试了还是下载失败.是不是cordove不再支持此插件了
ios没有弹出开启权限的弹窗,导致定位失败!
android
W/System.err: java.lang.ClassNotFoundException: com.aruistar.cordova.baidumap.BaiduMapLocation
at java.lang.Class.classForName(Native Method)
W/System.err: at java.lang.Class.forName(Class.java:400)
at java.lang.Class.forName(Class.java:326)
错误描述:NetWork location failed because baidu location service can not decrypt the request query, please check the so file!
请问 为什么第一次使用能正常定位并返回数据 第二次就报如此错
{"locType": 505, "locTypeDescription": "NetWork location failed because baidu location service check the key is unlegal, please check the key in AndroidManifest.xml !", "latitude": 5e-324, "longitude": 5e-324, "radius": 0, "userIndoorState": -1, "direction": -1 }
环境:
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : android 6.4.0
Ionic Framework : ionic-angular 3.9.2
System:
Node : v8.11.1
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 9.3 Build version 9E145
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : pro
代码:
getPosition(timeout: number = 5 * 1000): Promise < any > {
return new Promise((resolve, reject) => {
baidumap_location.getCurrentPosition((result) => {
console.log("baidumap_location result:", result);
resolve(result);
}, (error) => {
console.error("baidumap_location error:", error);
reject(error);
}, { timeout: timeout });
});
}
描述:
执行getPosition只会返回error,error信息为「code: -1,message: "Position retrieval timed out."」
您好,我在ios中引入该插件后,build工程提示下面的错误,没有引入插件之前是正常的
请问该如何解决?多谢
ator/lczOA.app/lczOA
Undefined symbols for architecture x86_64:
"std::__throw_length_error(char const*)", referenced from:
std::vector<_baidu_vi::vi_map::CBGLProgram*, std::allocator<_baidu_vi::vi_map::CBGLProgram*> >::reserve(unsigned long) in BaiduMapAPI_Base(BGLProgramCache.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
cordova.plugins.baidumap_location.getCurrentPosition((result) => {
alert('普通提示');
alert(JSON.stringify(result));
}, (error) =>{
alert(JSON.stringify(error));
});
请处理一下targetSdkVersion:25的动态权限问题
> cordova build ios
✖ Running command - failed!
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova build ios (exit code 1):
(truncated) ...
edData/紫金办公-cgdjvrcynptjancwzaihitcprwyl/Build/Intermediates/ArchiveIntermediates/紫金办公/IntermediateBuildFilesPath/紫金办公.build/Debug-iphoneos/紫金办公.buil/arm64/紫金办公_dependency_info.dat
-o
/Users/CK/Library/Developer/Xcode/DerivedData/紫金办公-cgdjvrcynptjancwzaihitcprwyl/Build/Intermediates/ArchiveIntermediates/紫金办公/IntermediateBuildFilesPath/紫金ebug-iphoneos/紫金办公.build/Objects-normal/arm64/紫金办公
ld: library not found for -lcrypto
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Ld
/Users/CK/Library/Developer/Xcode/DerivedData/紫金办公-cgdjvrcynptjancwzaihitcprwyl/Build/Intermediates/ArchiveIntermediates/紫金办公/IntermediateBuildFilesPath/紫金.build/Debug-iphoneos/紫金办公.build/Objects-normal/armv7/紫金办公
normal armv7
cd /Users/CK/Documents/oschina/zjft/zjft-oa/platforms/ios
export IPHONEOS_DEPLOYMENT_TARGET=9.0
没有安装ionic,直接在cordova中安装此plugin,html5中提示baidumap_location没有定义。直接发布成apk,在手机上没有反应!会是什么问题呢?
baidumap_location.getCurrentPosition(function (result) {
alert("================")
alert(JSON.stringify(result, null, 4));
}, function (error) {
});
安卓手机上(华为荣耀v9)调用定位方法时仅第一次定位有效,可以正常返回数据,后续再调用定位方法时,就会提示505.ios还没有测试过
如题
[_data setValue:countryCode forKey:@"countryCode"];
[_data setValue:country forKey:@"country"];
//[_data setValue:adCode forKey:@"citycode"];
[_data setValue:city forKey:@"city"];
[_data setValue:district forKey:@"district"];
[_data setValue:streetName forKey:@"street"];
[_data setValue:addr forKey:@"addr"];
[_data setValue:sematicDescription forKey:@"locationDescribe"];
,如何实现实时获取位置信息呢,目前指看到只有getCurrentPosition方法,@ aruis大师给个思路啊
安装插件后,进行模拟器编译:
xcode报错(xcode下真机测试一样是这个报错):
Apple Mach-O Linker Error
Linker command failed with exit code 1(use -v to see invocation)
Android Studio报错:
Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]
附上我的版本:
Xcode 版本 8.3.2
Android Studio for mac 版本 2.3.3
cordova版本7.0.1
ionic版本3.4.0
引入了cordova-plugin-baidumaplocation/www/baidumap_location.js 直接使用 baidumap_location.getCurrentPosition(),提示baidumap_location 未定义,用的3.2.0、3.0.2、3.0.1都是一样的结果,不知道什么原因,不知道作者有啥可以指导的么?谢谢!
首页感谢作者的的作品。我想咨询的是如标题所述的问题。
function loadJScript() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src =
"http://api.map.baidu.com/api?v=3.0&ak=mtTMj7tiV13LzegER84dRumg7dEQTic9&callback=init";
document.body.appendChild(script);
}
loadJScript();
baidumap_location.getCurrentPosition(function (result) {
var map = new BMap.Map("allmap");
var lon = result.longitude;
var lat = result.latitude;
var point = new BMap.Point(lon, lat);
map.centerAndZoom(point, 14);
//逆地址解析
var geoc = new BMap.Geocoder();
geoc.getLocation(point, function (r) {
var addComp = r.addressComponents;
alert(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street + ", " + addComp.streetNumber);
});
//add mark
var mk = new BMap.Marker(point);
map.addOverlay(mk);
}, function (error) {
});
1、我想咨询是,我使用的是作者的插件在手机上实现定位,返回经纬度,然后使用百度的javascript API 实现展示效果。但是现在我遇到的棘手情况是 第一次进入到应用定位页面是可以进行定位的,退出该页面再次进行定位时,定位出错。定位到非洲了。这不是我想要的效果。
2、或者是有没有方法使得我每次退出定位页面是终止定位功能。等我再打开时,再使用我的代码。
3、本人是第一次使用作者插件。
百度地图里好像有个接口setEnableSimulateGps(boolean enableSimulateGps)可以防止虚拟定位,这个项目有或者可以加吗?
ionic3
最近做项目发现,用了这个插件后,crosswalk 就用不了,请问有什么解决方法吗?项目急需crosswalk 优化 @aruis
之前我cordova version:5.4.0的时候是正常的
现在:
Cordova version: 6.5.0
"android-26"
Name: Android 8.0.0
Type: Platform
API level: 26
Revision: 2
无法获取地址,一直报超时。Position retrieval timed out.
安装插件日志:
Fetching plugin "[email protected]" via npm
Installing "cordova-plugin-baidumaplocation" for android
ANDROID_HOME=D:\Program Files (x86)\Android\android-sdk
JAVA_HOME=D:\Program Files\Java\jdk1.8.0_131
Subproject Path: CordovaLib
Configuration 'compile' in project ':' is deprecated. Use 'implementation' instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_3ipw43oaqfc43xtgb0czhnjef.run(D:\workspace\aaa\platforms\android\build.gradle:143)
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
:clean
:CordovaLib:clean
BUILD SUCCESSFUL in 5s
2 actionable tasks: 2 executed
cordova : Picked up _JAVA_OPTIONS: -Xmx512M
所在位置 行:1 字符: 1
+ CategoryInfo : NotSpecified: (Picked up _JAVA_OPTIONS: -Xmx512M:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Saved plugin info for "cordova-plugin-baidumaplocation" to config.xml
APP运行日志:
W/System.err( 9289): java.lang.ClassNotFoundException: com.aruistar.cordova.baidumap.BaiduMapLocation
W/System.err( 9289): at java.lang.Class.classForName(Native Method)
W/System.err( 9289): at java.lang.Class.forName(Class.java:324)
W/System.err( 9289): at java.lang.Class.forName(Class.java:285)
W/System.err( 9289): at org.apache.cordova.PluginManager.instantiatePlugin(PluginManager.java:489)
W/System.err( 9289): at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:169)
W/System.err( 9289): at org.apache.cordova.PluginManager.exec(PluginManager.java:122)
W/System.err( 9289): at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:57)
W/System.err( 9289): at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
W/System.err( 9289): at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
W/System.err( 9289): at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:41)
W/System.err( 9289): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 9289): at android.os.Looper.loop(Looper.java:150)
W/System.err( 9289): at android.os.HandlerThread.run(HandlerThread.java:61)
W/System.err( 9289): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.aruistar.cordova.baidumap.BaiduMapLocation" on path: DexPathList[[zip file "/data/app/com.xxx.yyy-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xxx.yyy-1/lib/arm64, /vendor/lib64, /system/lib64]]
W/System.err( 9289): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
W/System.err( 9289): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
W/System.err( 9289): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
W/System.err( 9289): ... 13 more
W/System.err( 9289): Suppressed: java.lang.ClassNotFoundException: com.aruistar.cordova.baidumap.BaiduMapLocation
W/System.err( 9289): at java.lang.Class.classForName(Native Method)
W/System.err( 9289): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
W/System.err( 9289): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
W/System.err( 9289): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
W/System.err( 9289): ... 14 more
W/System.err( 9289): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
I/System.out( 9289): Error adding plugin com.aruistar.cordova.baidumap.BaiduMapLocation.
W/System.err( 9289): java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CordovaPlugin.privateInitialize(java.lang.String, org.apache.cordova.CordovaInterface, org.apache.cordova.CordovaWebView, org.apache.cordova.CordovaPreferences)' on a null object reference
W/System.err( 9289): at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:171)
W/System.err( 9289): at org.apache.cordova.PluginManager.exec(PluginManager.java:122)
W/System.err( 9289): at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:57)
W/System.err( 9289): at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
W/System.err( 9289): at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
W/System.err( 9289): at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:41)
W/System.err( 9289): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err( 9289): at android.os.Looper.loop(Looper.java:150)
W/System.err( 9289): at android.os.HandlerThread.run(HandlerThread.java:61)
direction
:
-1
latitude
:
5
e-324
locType
:
505
locTypeDescription
:
"NetWork location failed because baidu location service check the key is unlegal, please check the key in AndroidManifest.xml !"
longitude
:
5
e-324
radius
:
0
userIndoorState
:
-1
请问应用后台挂起后还能定位吗?
05-16 10:30:37.512 13192-13192/com.chumi.qscrm I/chromium: [INFO:CONSOLE(38)] "坐标=============获取成功{"time":"2017-05-16 10:30:38","locType":161,"locTypeDescription":"NetWork location successful!","latitude":29.532723,"lontitude":106.575376,"radius":40,"countryCode":"0","country":"**","citycode":"132","city":"重庆市","district":"南岸区","street":"江南大道","addr":"**重庆市南岸区江南大道8号","userIndoorState":1,"direction":-1,"locationDescribe":"在万达国际写字楼2栋附近"}", source: file:///android_asset/www/js/checkWork.js (38)
05-16 10:30:37.622 13192-13192/com.chumi.qscrm I/chromium: [INFO:CONSOLE(42)] "坐标=============获取显示106.575376==================29.532723", source: file:///android_asset/www/js/checkWork.js (42)
05-16 10:30:43.732 13192-13192/com.chumi.qscrm I/chromium: [INFO:CONSOLE(7)] "初始化======checkwork", source: file:///android_asset/www/js/checkWork.js (7)
05-16 10:30:44.032 13192-13192/com.chumi.qscrm I/chromium: [INFO:CONSOLE(38)] "坐标=============获取成功{"locType":505,"locTypeDescription":"NetWork location failed because baidu location service check the key is unlegal, please check the key in AndroidManifest.xml !","latitude":5e-324,"lontitude":5e-324,"radius":0,"userIndoorState":-1,"direction":-1}", source: file:///android_asset/www/js/checkWork.js (38)
gps定位返回的结果里没有语义化地址
网络定位返回的有
目前自己使用 ionic3 ,cordova-android: 7.0.0,打包成APP,运行后发现,可以正常获取经纬度,但是开启飞行模式后无法获取。
根据Android 8.0的开发指引,为了适配这一系统特性,百度地图定位SDK新增加接口。它的实现原理就是开发者通过新接口生成一个前台服务通知,使得开发者自己的应用退到后台的时候,仍有前台通知在,规避了Android 8.0系统对后台定位的限制。
http://lbsyun.baidu.com/index.php?title=android-locsdk/guide/addition-func/android8-notice
大神的这个插件在android8.0的后台定位好像表现不是很好,隔几分钟就会停止,是否根据android8.0做过相应优化?谢谢!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.