应用程序启动谷歌地图

时间:2016-03-25 03:19:45

标签: javascript angularjs cordova google-maps phonegap-plugins

我已经使用角度框架工作实现了cordova应用程序。请指导我通过传递经度和长度来启动谷歌地图或地图应用程序。

2 个答案:

答案 0 :(得分:2)

如果您希望应用打开InAppBrowser:

var url = 'http://www.google.com/maps/place/' + latitude ',' + longtitude;
var inAppBrowser = window.open(url, '_blank', 'location=yes');

如果您想要开放原生谷歌地图应用程序:

window.location = 'comgooglemaps://?center=40.765819,-73.975866&zoom=14&views=traffic'

如果您想在用户手机上打开地图应用默认设置:

window.location = 'geo:40.765819,-73.975866'

您可以在其中找到更多详细信息:Android Phonegap - How to Open Native Google Maps Application

可以在此处找到更多Google地图的网址方案:https://developers.google.com/maps/documentation/ios-sdk/urlscheme#display_directions

答案 1 :(得分:1)

我认为你可以用这样的特定意图来做到这一点:

        String uri = String.format(Locale.ENGLISH, "geo:%f,%f", latitude,   longitude);
         Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
        context.startActivity(intent);