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 🙏

© 2026 – Pkg Stats / Ryan Hefner

baidu-location

v0.0.3

Published

版本 0.0.3

Readme

nativeScript 百度定位插件

版本 0.0.1

作者 spzhao

Email [email protected]

百度定位sdk版本 7.0

添加插件

  • 该插件未添加到npm,需要先clone到本地,再添加到项目中
  • git clone https://git.oschina.net/spzhao/ns-baidu-location.git
  • 修改百度定位的AK:
  • 编辑platform/android/AndroidManifest.xml
  • 修改百度AK
  • 替换 BAIDU_API_KEY 为你申请的AK
  • 在项目目录下:tns plugin add file/to/plugin/path

使用

配合 nativescript-permissions 使用

优点:如果未授权,会提示授权定位,同意后进行定位 添加 nativescript-permissions 插件: tns plugin add nativescript-permissions

var permissions = require( "nativescript-permissions" );
var baiduMap = require("baidu-location")
permissions.requestPermission(android.Manifest.permission.ACCESS_FINE_LOCATION, "")
            .then(function() {
                baiduMap.getPosition()
                    .then(function(pos){
                        ...
                    })
                    .catch(function(err){
                       ...
                    })
            })
            .catch(function() {
                console.log("permission denied");
            });

直接使用

缺点:如果未授权,会提示授权,但是授权后需要再执行一次才会进行定位

    var baiduMap = require("baidu-location")
    baiduMap.getPosition()
         .then(function(pos){
              ...
         })
         .catch(function(err){
              ...
         })

返回数据

  • 类型: json
{
   addr: '位置信息',
   locType: '返回类型', // 具体返回类型可以查看百度官方说明 
   latitude: 'latitude',
   longitude: 'longitude',
   radius: '误差半径'
}

查看百度定位AndroidSDK错误码