科尔多瓦 - 如何检测是否安装了谷歌地图应用程序 [英] Cordova - How to detect whether google maps app is installed

查看:347
本文介绍了科尔多瓦 - 如何检测是否安装了谷歌地图应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的科尔多瓦建设一个混合的应用程序。我想检测谷歌地图应用程序是否已安装在iOS和Android设备。

I am building a hybrid app using cordova. I would like to detect whether google maps app has been installed on ios and android devices.

重定向到谷歌地图应用程序之前,我想检查是否应用程序是在设备上安装实际上可以。

Before redirecting to google maps app i would like to check whether the app is acutally installed on device.

我使用下列URL重定向 -

I am redirecting using following urls -

有关IOS: comgooglemaps://maps.google.com/

有关Android的:地理:0,0 q

For android: geo:0,0?q

在此先感谢

推荐答案

这可以通过使用 ngCordova 插件来实现的。 http://ngcordova.com/

This can be achieved using ngCordova plugins. http://ngcordova.com/

使用的 $ cordovaAppAvailability ,我们可以找出任何应用程序是否安装或不使用它的URI方案。详细的文档这里

Using $cordovaAppAvailability we can identify whether any app is installed or not using its URI Scheme. Detailed docs here

有关谷歌地图URI方案 -

For google maps URI schemes are -

Android版本: com.google.android.apps.maps
IOS: comgooglemaps://

Android: com.google.android.apps.maps ios: comgooglemaps://

$cordovaAppAvailability
    .check('com.google.android.apps.maps')
    .then(function(success) {
      // success
    },
    function (error) {
      // error
    });

这篇关于科尔多瓦 - 如何检测是否安装了谷歌地图应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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