移动html5推出手机的本机导航应用程序 [英] mobile html5 launch phone's native navigation app

查看:145
本文介绍了移动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地图)和iOS 6 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"

但启动原生Google Navigator应用程式在Android上,你需要使用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地图的选项。

Update The 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推出手机的本机导航应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆