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-navi

v1.0.0

Published

Cordova Navi Plugin call app,use Baidu Map APP and Amap App

Downloads

5

Readme

cordova-plugin-navi

ionic cordova 导航插件,URI方式调用高德和百度APP,支持Android和ios

使用

高德地图uri api

    //引用导航插件
    declare let Navi;
    //android平台
    Navi.amapRoute('amapuri://route/plan/?sourceApplication=APP名称'+
    '&dlat=39.98848272&dlon=116.47560823&dname=中村关&dev=0&t=0'
        , res => {
            //成功
        }
        , err => {
            //失败
        }
    );

    //ios平台
    Navi.amapRoute('iosamap://path?sourceApplication=APP名称'+
    '&dlat=39.98848272&dlon=116.47560823&dname=中村关&dev=0&t=0'
        , res => {
            //成功
         }
        , err => {
            //失败
        }
    );

百度地图uri api

    //
    Navi.bdmapRoute('baidumap://map/direction?'+
    'destination=latlng:39.9761,116.3282|name:中关村&mode=driving'
      , res => {
          //成功
       }
      , err => {
          //失败
      }
    );

二次封装service

import { Injectable } from '@angular/core';
import { FileServ } from '../../providers/common/FileServ';
declare let Navi;

@Injectable()
export class NaviServ {

    constructor(private fileServ: FileServ) {

    }

    /**
     * 高德地图
     * @param dlat 终点纬度
     * @param dlon 终点经度
     * @param dname 终点名称
     */
    public amapRoute(dlat: string, dlon: string, dname: string): Promise<string> {
        return new Promise<string>((resolve, reject) => {

            if (this.fileServ.isAndroid()) {
                Navi.amapRoute('amapuri://route/plan/?sourceApplication=APP名称&dlat=' + dlat + 
                '&dlon=' + dlon + '&dname=' + dname + '&dev=0&t=0',
                    res => {
                        resolve(res);
                    },
                    err => {
                        reject(err);
                    });
            } else {
                Navi.amapRoute('iosamap://path?sourceApplication=APP名称&dlat=' + dlat +
                    '&dlon=' + dlon + '&dname=' + dname + '&dev=0&t=0',
                    res => {
                        resolve(res);
                    }, err => {
                        reject(err);
                    });
            }
        });
    }

    /**
     * 百度地图
     * @param dlat 终点纬度
     * @param dlon 终点经度
     * @param dname 终点名称
     */
    public bdmapRoute(dlat: string, dlon: string, dname: string): Promise<string> {
        return new Promise<string>((resolve, reject) => {

            if (this.fileServ.isAndroid()) {
                Navi.bdmapRoute('baidumap://map/direction?destination=latlng:' + dlat + 
                ',' + dlon + '|name:' + dname+'&mode=driving',
                    res => {
                        resolve(res);
                    },
                    err => {
                        reject(err);
                    });
            } else {
                Navi.bdmapRoute('baidumap://map/direction?destination=latlng:' + dlat + 
                ',' + dlon + '|name:' + dname +'&mode=driving',
                    res => {
                        resolve(res);
                    }, err => {
                        reject(err);
                    });
            }
        });
    }
}