Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Supporting Amazon and Android market (Google Play) links inside application

So one of my applications was rejected from the Amazon app store today. The reason was because inside my app, I linked to the paid version of the app on the Android market. Disappointing, but whatever, I guess everyone wants their cut...

So now I'm left having to modify the application to change the Android market link to an Amazon app store link. Not really a big deal except for now if I do that I'm left with a discrepancy when I want to upload a newer version back to the Android market. After all, it would be rather dumb to link someone to the Amazon app store if they purchase the app from the Android market.

Now we all know that it is a pain supporting/managing multiple versions of the same app. Consequently my question becomes how can I link to both at the same time? Is there a way to tell where an app was downloaded from so I can code both links into the app and thus point the user automatically to one or the other? Secondly, is it against the Amazon TOS to give the user a choice (say I pop up a dialog instead and ask the user where to download from)?

Thanks all.

Edit: Direct from Amazon customer service "Re: Link to both markets" (I wish the approval process was as fast as these guys):

For the time being, we need any linking to point back to the Amazon Appstore only for market links. Linking to your website is allowed, just not other markets.

When pointing to other apps from within your app, including up-sells, completion of purchase must be from the Amazon Appstore.

like image 824
user432209 Avatar asked Mar 29 '11 23:03

user432209


People also ask

What happened to Amazon Android app?

Amazon has stopped letting customers download e-books and any other digital content from its Android shopping app. It is asking them to instead buy books via its website or Kindle app.

Is Amazon Appstore like Google Play?

What Is the Amazon App Store? Simply put, the Amazon App Store is the app store that is available on all Amazon Fire devices, including the Kindle Fire and the Fire Stick. It essentially serves the same purpose as the Google Play Store and has Android apps for these devices.


3 Answers

Good news! Apparently the latest version of the Amazon store finally sets PackageManager.getInstallerPackageName() to "com.amazon.venezia" to contrast with Google Play's "com.android.vending". This will be the easiest way to determine if your app is sideloaded, installed from Amazon, or installed from Google.

like image 142
mttmllns Avatar answered Nov 14 '22 03:11

mttmllns


Here's what you can do:

  1. Complete the preparation and signing of your application.
  2. Install it on your test device
  3. Use PackageManager.getPackageInfo

How to do this:

public static boolean isMarket(Context context){     boolean isMarketSig = false;     int currentSig = 1;     try {         Signature[] sigs = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES).signatures;         for (Signature sig : sigs)         {             currentSig = sig.hashCode();       Log.i("MyApp", "Signature hashcode : " + sig.hashCode()); // This Log is for first time testing so you can find out what the int value of your signature is.             }             } catch (Exception e){                 e.printStackTrace();   } //-1545485543 was the int I got from the log line above, so I compare the current signature hashCode value with that value to determine if it's market or not.         if (currentSig==-1545485543){             isMarketSig = true;     } else {         isMarketSig = false;     }      return isMarketSig; } public static void openStore(Context context){     if (isMarket(context)){         Intent goToMarket = new Intent(Intent.ACTION_VIEW,Uri.parse("market://d" +         "etails?id=com.jakar.myapp"));         goToMarket.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);         context.startActivity(goToMarket);       } else {         Intent goToAppstore = new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.amazon.com/gp/mas/dl/andro" +         "id?p=com.jakar.myapp"));         goToAppstore.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);         context.startActivity(goToAppstore);     } } 

Basically, the hashCode() that you get from the app installed on your testing device will be the same one from the market. The hash code from the app store will be different because according to https://developer.amazon.com/help/faq.html, the app store signs the application with a signature specific to your developer account, so that will return a different value that what you actually signed it with.

Note: It works to open the market successfully, but I haven't yet deployed this method on the App Store, so I haven't completely tested it. I am confident it will work, but can make no guarantees, so if you use what I've suggested and it fails, please don't hold me accountable.

like image 21
Reed Avatar answered Nov 14 '22 03:11

Reed


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

like image 38
Sagar Waghmare Avatar answered Nov 14 '22 02:11

Sagar Waghmare