Linking back to amazon app store for ratings

android, android-intent, android-studio, java

Solution

Just use following code. It's at first trying to open market application by URI, but if it is not found open web link.

public static final String MARKET_AMAZON_URL = "amzn://apps/android?p=";
public static final String WEB_AMAZON_URL = "http://www.amazon.com/gp/mas/dl/android?p=";

    private static void openOnAmazonMarket(Context context, String packageName) {

    try {
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(MARKET_AMAZON_URL + packageName));
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    } catch (android.content.ActivityNotFoundException anfe) {
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(WEB_AMAZON_URL + packageName));
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    }

}

For Google Play and Samsung Galaxy Apps links are following:

public static final String MARKET_GOOGLE_URL = "market://details?id=";
public static final String WEB_GOOGLE_URL = "http://play.google.com/store/apps/details?id=";

public static final String MARKET_SAMSUNG_URL = "samsungapps://ProductDetail/";
public static final String WEB_SAMSUNG_URL = "http://www.samsungapps.com/appquery/appDetail.as?appId=";

Problem

I am currently using the following code within my android app on The Google Play Store to request a review and a rating of my app. ``` Intent goToMarket = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.yapp.blah")); goToMarket.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(goToMarket); ``` How can I link back to The Amazon App Store or Amazon Market to achieve the same thing?

Original source

Related problems