npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-scm-amap-location

v1.0.3

Published

Cordova Plugin for amap location

Downloads

8

Readme

cordova-plugin-gaode-location

基于cordova封装的高德地图定位插件

  • 单次定位 getLocation方法 去除retGeo参数
  • 持续定位 watchLocation方法

变更

  • 当无权限时直接返回错误回调,不直接显示错误信息。 errorCode: 12

Install

cordova plugin add cordova-plugin-gaode-location-v2 --variable ANDROIDKEY=YOU_ANDROIDKEY --variable IOSKEY=YOU_IOSKEY --variable LOCATION_USAGE_DESCRIPTION="使用定位功能以查询人员附近公交车辆"

Parameters

Android端和iOS端各自有各自的参数

configLocation方法

Android:

  • locationMode(number):定位的模式(精度逐级递减,具体对应的模式参考官网),默认: 1
    • 1:Hight_Accuracy
    • 2:Device_Sensors
    • 3:Battery_Saving
  • httpTimeout:定位超时时间, 单位ms,默认:30000

iOS

  • accuracy(number):定位精度(精度逐级递减,具体对应的模式参考官网),默认:3

    • 1: kCLLocationAccuracyBestForNavigation
    • 2: kCLLocationAccuracyBest
    • 3: kCLLocationAccuracyNearestTenMeters
    • 4: kCLLocationAccuracyHundredMeters
    • 5: kCLLocationAccuracyKilometer
    • 6: kCLLocationAccuracyThreeKilometers
  • locationTimeout:定位超时时间,单位s 默认:10

  • reGeoCodeTimeout:逆地址超时时间,单位s 默认:5

    getLocation方法

    • ~~retGeo: 是否返回逆地址,默认:true, 这个参数已不再生效~~

Success return data

  • latitude:经度
  • longitude:纬度
  • country: 国家
  • province:省
  • city:市
  • district:区
  • address:具体地址
  • cityCode: 城市代码
  • adCode: 行政区划代码

Useage

var onLocationReady = $q.defer();
// 定制参数
var para = {
  android: {
    // set some parameters
  },
  ios: {
    // set some parameters
  }
}
// 配置手机定位(可选)
GaodeLocation.configLocation(para, function (successMsg) {
  // do something
  onLocationReady.resolve();
});

// 如果需要配置定位信息,需要以方式实现
onLocationReady
  .promise
  .then(function () {
    GaodeLocation.getLocation(function (locationInfo) {
      // do something
    }, function (err) {
      console.log(err);
    });
    GaodeLocation.watchLocation(function (locationInfo) {
      // first time will return 'requestCode', {requestCode: 1234}, use this code to stop watchLocation
      // do something
    }, function (err) {
      console.log(err);
    });
    GaodeLocation.stopWatch(requestCode, function (successMsg) {
      // do something
    }, function (err) {
      console.log(err);
    });
  });
  
//可直接调用getLocation等方法。
GaodeLocation.getLocation(function (locationInfo) {
  // do something
}, function (err) {
  console.log(err);
});
GaodeLocation.watchLocation(function (locationInfo) {
  // first time will return 'requestCode', {requestCode: 1234}, use this code to stop watchLocation
  // do something
}, function (err) {
  console.log(err);
});
GaodeLocation.stopWatch(requestCode, function (successMsg) {
  // do something
}, function (err) {
  console.log(err);
});