第一步

    安装inappbrowser


cordova plugin add org.apache.cordova.inappbrowser


或者

npm i cordova-plugin-inappbrowser

打开方式:

  mapNavigation() {
    let markerData = this.pointData;

    if (this.platform.is('ios')) {
      let uri = 'iosamap://navi?sourceApplication=ydzf&lat=' + markerData.latitude + "&lon=" + markerData.longitude + "&dev=1&style=2"
      window.open(uri, '_system');
    } else if (this.platform.is('android')) {
      let path = 'file:///data/data/';
      File.checkDir(path, 'com.autonavi.minimap').then((s: boolean) => {
        let uri = 'androidamap://navi?sourceApplication=ahpcp&lat=' + markerData.latitude + "&lon=" + markerData.longitude + "&dev=1&style=2"
        window.open(uri, '_system');
      }, (e) => {
        Toast.show('未安装高德地图,即将前往下载', '2000', 'center').subscribe(t => {
          window.open('http://wap.amap.com/', '_system');
        });
      });

    }
  }

其他使用例子可见:https://www.npmjs.com/package/cordova-plugin-inappbrowser



欢迎留言