21

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?

Ömer Erden
  • 7,680
  • 5
  • 36
  • 45
Ahmed
  • 14,503
  • 22
  • 92
  • 150

4 Answers4

16

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=";
AndreyICE
  • 3,574
  • 29
  • 27
14

You can do the following things:

  1. Check if the device based on its Manufacturer. For ex: https://developer.amazon.com/sdk/fire/specifications.html

  2. For writing reviews and opening the Amazon App Store use the following intent

    amzn://apps/android?p=package_name
    

    where p=Link to the detail page for a specific package name.

Ref: Amazon developer link.

https://developer.amazon.com/sdk/in-app-purchasing/sample-code/deeplink.html

Sagar Waghmare
  • 4,702
  • 1
  • 19
  • 20
  • Using the URL amzn://apps/android?p=package_name crashes on Kindle Fire emulator. According to the https://developer.amazon.com/sdk/in-app-purchasing/sample-code/deeplink.html the http://www.amazon.com/gp/mas/dl/android?p=package_name format should also start the Amazon Client. – petrsyn Dec 31 '13 at 11:49
  • Why don't you try it on actual device. Did you got ActivityNotFound exception ? – Sagar Waghmare Dec 31 '13 at 12:44
  • I don't have real device yet. Yes it throws ActivityNotFoundException. – petrsyn Dec 31 '13 at 15:05
  • 1
    Ok. This is what i have done. Used try catch(ActivityNotFoundEx). Used amzn: in try block and used URL in catch block. For devices having the correct activity handler will directly open the AppStore App and for rest of the devices it will open the URL in a browser. – Sagar Waghmare Jan 02 '14 at 11:47
  • 1
    how do you manage the differents store of amazon ? amazon.com / fr / de etc. – P. Sohm Jul 16 '14 at 14:11
1

This is the preferred method and will directly open up the Amazon Appstore for Android:

amzn://apps/android?p=<package_name>

Source: https://developer.amazon.com/public/community/post/Tx3A1TVL67TB24B/Linking-To-the-Amazon-Appstore-for-Android

Julio Gorgé
  • 10,056
  • 2
  • 45
  • 60
-1

There are two methods to do it:

Option 1: Link to the Amazon Retail Website

This type of link will be picked up by the Amazon Appstore for Android as well as any installed browsers on the device. The base URL is as follows:

http://www.amazon.com/gp/mas/dl/android?

Option 2: Link directly to the Amazon Appstore for Android

This specially formatted link is the preferred method and will directly open up the Amazon Appstore for Android. The base URL is as follows:

amzn://apps/android?

http://www.amazon.com/HUT-Solution-Loving-Pakman/dp/B00HYT72LU