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-plugin-yzt-amap

v1.0.7

Published

Amap Maps native SDK for Android and iOS. This plugin allows your application to use the native Amap Maps views instead of the Amap Maps JavaScript API v3. The native map view is faster, use less network usage, display 3D views, and even work on offline n

Downloads

6

Readme

cordova Amap plugin for iOS and Android

This plugin is a thin wrapper for Amap Maps Android API and Amap Maps SDK for iOS. Both PhoneGap and Apache Cordova are supported.


Quick install

npm (current stable 2.0.1)

$> cordova plugin add cordova-plugin-yzt-amap --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"

Github (current master, potentially unstable)

$> cordova plugin add https://github.com/Silverbase-FE/cordova-plugin-yzt-amap --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"

If you re-install the plugin, please always remove the plugin first, then remove the SDK

$> cordova plugin rm cordova-plugin-yzt-amap
$> cordova plugin add cordova-plugin-yzt-amap --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"

The SDK-Plugin won't be uninstalled automatically and you will stuck on an old version.

API Reference

  • getCurrentPosition
  • startUpdatePosition
  • readUpdatePosition
  • stopUpdatePosition
  • showMap
  • hideMap
  • traceMap

Android

iOS

地图插件总结

  • 做过很多项目都有使用地图的场景,原生app,混合app,H5页面,有基于gps信号定位的,基于ip定位的,基于基站定位的。比如:

cordova-plugin-geolocation

Common sources of location information include Global Positioning System (GPS) and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs. There is no guarantee that the API returns the device's actual location.

在实际的使用过程中,误差在1km左右,并没有描述的这么精确。而且在一些gps有问题的手机上,这个是不会有返回的,比如小米4。

H5定位,根据ip,这个误差就不提了。

目前采用的cordova调用高德地图sdk的方式,采用GPS定位,基站定位,混合定位三种定位模式,精度还算比较理想,误差在10m左右。获取的经纬度信息后可选择调用,经纬度地理信息转换接口,就可以清楚的看到当前的位置信息。这是一种较好的高精度定位解决方案。

  • 遇到的坑

1、Cordova Android 7.0.0后生成的Platform Android目录结构有变更。官方说明文档

With this release, we have changed the default project structure for Android projects. People who currently use the CLI and treat everything in the platforms directory as a build artifact should not notice a difference.

2、Android 6.0及以上版本 动态权限问题

Android 6.0及以上版本调用原生功能,需要加入动态权限。示例代码如下图所示,加在生成的 MainActivity.java 文件中。

3、关于高德地图key,SHA1

1、包名(PackageName)要唯一

2、每次打包需要是发布版安全码SHA1的签名包,不然会报错。如何获取发布版安全码SHA1

demo code repository

https://github.com/Silverbase-FE/testApp-plugin-amap 点击前往


开发调试插件,也是花费了大量的业余时间,如果对您有帮助,点个star吧!

由于能力有限,如有纰漏,欢迎多多交流!