androidiosiphonecordovaphonegap-plugins

How to link Cordova app to App Store?


How can I create a link button in my cordova app, which is redirecting to my app on iOS/Android/Amazon App Store depending on the device?

I have tried the following code, it gets in the iOS if clause, but it doesn't redirect me, neither gives an error:

if(window.cordova && window.device) {
    if (device.platform.toUpperCase() === 'IOS') {
        window.open("https://itunes.apple.com/gb/[OBFUSCATED]");
    } else if (device.platform.toUpperCase() === 'ANDROID') {
        window.open("https://play.google.com/store/apps/details?id=[OBFUSCATED]");
    } else {
        window.open("https://www.amazon.co.uk/[OBFUSCATED]");
    }
}

Solution

  • I figured it out:

    IOS: itms-apps://itunes.apple.com/app/[appId]
    Android: market://details?id=[appPackageId]
    Amazon: amzn://apps/android?p=[appPackageId]