Cordova - How to tell if the Google Maps app is installed

I am creating a hybrid application using cordova. I would like to detect if google maps app is installed on ios and android devices.

Before redirecting the google maps app, I would like to check if the app is actually installed on the device.

I am redirecting using the following urls -

For ios: comgooglemaps://maps.google.com/

For android: geo:0,0?q

Thank you in advance

+3


source to share


1 answer


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

Using $ cordovaAppAvailability , we can determine if an app is installed or not using its URI scheme. Detailed docs here

For Google Maps URI schemes -



Android: com.google.android.apps.maps

ios:comgooglemaps://

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

      

+2


source







All Articles