ohh2ahh / AppAvailability

This Cordova / PhoneGap plugin allows you to check if an app is installed.
229 stars 116 forks source link

Launch if it is available #27

Closed calebeaires closed 8 years ago

calebeaires commented 8 years ago

Would be nice if this plugin could launch the app or go to Play Store/App Store. So we could do this

appAvailability.check(
    'twitter://', // URI Scheme
    function() {  // Success callback
        console.log('Twitter is available');
        appAvailability.launch("twitter://");
    },
    function() {  // Error callback
        appAvailability.goPlayStore("twitter://")
    }
);
ohh2ahh commented 8 years ago

Hi @calebeaires I want to keep the plugin as simple as possible. Therefore, I won't add this functionality. But as an alternative you could realize your intent with Cordova's in-app browser plugin (not tested):

appAvailability.check(
    'twitter://', // URI Scheme
    function() {  // Success callback
        console.log('Twitter is available');
        cordova.InAppBrowser.open('twitter://', '_system');
    },
    function() {  // Error callback
        cordova.InAppBrowser.open(<Play-Store-URL>, '_system');
    }
);