Code Monkey home page Code Monkey logo

cordova-plugin-baidumaplocation's Issues

使用后获取不到数据?

"latitude": 5e-324,
"lontitude": 5e-324,
但是我用6.2.3版本的时候是可以获取定位的,应该不是我key的问题。不明白什么原因

为什么我第二次调用就会报错呢

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

ios 返回数据缺少 province

[_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"];

关于第二次定位信息错误的问题,有KEY

你好,很感谢你提供了这样的一个定位插件,对我很有帮助!
但是我现在也遇到了定位有时返回的数据不正确的情况,这边已确认添加了KEY,我同时试了我们的KEY和您提供的DEMO里面的KEY,都出现过,请问针对这个问题有什么解决办法么?谢谢!

ios如何设置火星坐标系

请问如何设置iOS定位返回的类型是火星坐标系,看了一下官网,是不是iOS的不支持?安卓的是可以的,如果iOS的也可以请问如何设置呢?小哥哥

请求帮助,IOS build 报错

您好,我在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)

插件add失败

添加插件的时候很慢.但是最后显示
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不再支持此插件了

为什么第一次使用能正常定位返回数据 第二次就报错

请问 为什么第一次使用能正常定位并返回数据 第二次就报如此错
{"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 }

cordova plugin add 安装插件失败

你好,在安装插件时显示 UnhandledPromiseRejectionWarning: CordovaError: Variable(s) missing (use: --variable IOS_KEY=value),由于暂时只使用安卓,所以只使用了 --variable ANDROID_KEY=“<ANDROID_KEY>”,看到项目首页说明可以只提供一个参数,现在是否必须提供两个?

Cordova version: 6.5.0插件失效,无法获取地址。一直报超时:Position retrieval timed out.

之前我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

  • cordova plugin add cordova-plugin-baidumaplocation --variable ANDROID ...
  •   + 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)

ionic2 中使用时,ionic cordova build ios 报错

> 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

ionic3上使用插件并打了android包,测试时一直报超时

环境:
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."」

Android真机调试,baidumap_location is undefined

版本信息:
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
请问如何解决?谢谢了

第一次定位成功,第二次定位到非洲几内亚湾了。

首页感谢作者的的作品。我想咨询的是如标题所述的问题。
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、本人是第一次使用作者插件。

添加插件报错是什么原因呢?

安装插件后,进行模拟器编译:
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

baidumap_location.getCurrentPosition在安卓中调用无反应,没有报错信息;ios中完美运行

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)
      });
  })

Android 8.0系统增加了很多新特性,对位置影响较大的特性就是增强了对后台定位的限制

根据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做过相应优化?谢谢!

与crosswalk 冲突

最近做项目发现,用了这个插件后,crosswalk 就用不了,请问有什么解决方法吗?项目急需crosswalk 优化 @aruis

插件是否支持离线获取经纬度

目前自己使用 ionic3 ,cordova-android: 7.0.0,打包成APP,运行后发现,可以正常获取经纬度,但是开启飞行模式后无法获取。

cordova不能定位!

没有安装ionic,直接在cordova中安装此plugin,html5中提示baidumap_location没有定义。直接发布成apk,在手机上没有反应!会是什么问题呢?
baidumap_location.getCurrentPosition(function (result) {
alert("================")
alert(JSON.stringify(result, null, 4));
}, function (error) {
});

baidumap_location 未定义

引入了cordova-plugin-baidumaplocation/www/baidumap_location.js 直接使用 baidumap_location.getCurrentPosition(),提示baidumap_location 未定义,用的3.2.0、3.0.2、3.0.1都是一样的结果,不知道什么原因,不知道作者有啥可以指导的么?谢谢!

定位刚进程序能定位,第二次请求就报错了,报key错误,

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)

有些设备定位失败

错误描述:NetWork location failed because baidu location service can not decrypt the request query, please check the so file!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.