移动html5启动电话的本机导航应用

移动html5启动电话的本机导航应用

本文介绍了移动html5启动电话的本机导航应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个phonegap/cordova应用程序.有没有办法在浏览器视图中打开手机的本机导航应用程序?还是从html5应用程序打开本机地图应用程序的最佳做法?还是它们都是特定于平台的?

I'm developing a phonegap/cordova app. Is there a way to open a phone's native navigation app within the browser view? Or is there a best practice on opening native map applications from html5 apps? Or are they all platform specific?

我已经阅读了一些适用于某些Android版本的地方

I've read some places that the following works for certain versions of Android

<a href="geo:some address here" />Navigate to here</a>

这适用于iOS

<a href="http://maps.apple.com/?daddr=San+Francisco,+CA&saddr=cupertino">Directions</a>

我很惊讶Phonegap尚未实现这样的功能.

I'm amazed that Phonegap hasn't implemented something like this.

推荐答案

您可以使用神奇的地图:"协议,例如,在iOS 5(Google Maps)和iOS 6(Apple Maps)上打开本机导航应用程序. window.location = "maps:daddr=50.4,-4.5"

You can open the native navigation app on iOS 5 (Google Maps) and iOS 6 (Apple Maps) by using the magic "maps:" protocol, e.g. window.location = "maps:daddr=50.4,-4.5"

但是要在Android上启动本机Google Navigator应用程序,您需要使用phonegap插件.我写这本书是出于我自己的目的.

But to launch the native Google Navigator app on Android you need to use a phonegap plugin. I wrote this one for my own purposes.

更新该插件现已针对Phonegap 3.x进行了更新,并支持Android,iOS和Windows Phone,其中包括在iOS设备上更喜欢Google Maps的选项.

UpdateThe plugin has now been updated for Phonegap 3.x and supports Android, iOS and Windows Phone, including an option to prefer Google Maps on iOS.

插件在这里: https://github.com/dpa99c/phonegap-launch-navigator

这篇关于移动html5启动电话的本机导航应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 01:38