Skip to content

zjw1918/cordova-plugin-baidugeolocation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cordova-plugin-baidugeolocation

Android端调用百度Android 定位sdk

安装

cordova plugin add cordova-plugin-baidugeolocation --variable ANDROID_KEY=YOUR_BAIDU_ANDROID_APIKEY

用法

// watch
BaiduGeolocation.startWatch(function(p) {
    console.log(p);
}, function (err) {
    console.error(err);
})

setTimeout(function() {
    BaiduGeolocation.stopWatch();
}, 20 * 1000);

// getCurrent
BaiduGeolocation.getCurrentPosition(function (res) {
    console.log(res);
}, function (err) {
    console.log(err);
});

说明

  1. ios定位可以直接用cordova-plugin-geolocation, 没有必要再造轮子。返回wgs的经纬度。
  2. 这个插件调用的百度定位sdk。返回bd09ll的经纬度。
  3. It is the same way to use in ionic, cordova, typescript, plainjs.

参考:

https://github.com/aruis/cordova-plugin-baidumaplocation

https://github.com/ionic-team/cordova-plugin-template

https://github.com/apache/cordova-plugin-geolocation

About

Ok to use in my proj, so share it.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages