15

I have recently got my app rejected from Amazon Mobile App Distribution Portal with the argument that the Menu->"Rate the App" option redirects to Google Play Store.

In order to be accepted it should redirect to the Amazon Appstore, the Download URL must be http://www.amazon.com/gp/mas/dl/android?p=packagename which of course makes sense.

So I need something like:

String url = isKindle 
    ? "http://www.amazon.com/gp/mas/dl/android?p=packagename" 
    : "https://play.google.com/store/apps/details?id=packagename";

The question is: how can I distinguish if the app runs on Kindle Fire or on a "native" Android system?

Ilya Shinkarenko
  • 2,134
  • 18
  • 35
  • 2
    I don't know the answer to this, but don't people typically just export a separate APK for submittal to the Amazon Appstore? – Kevin Coppock Jul 11 '12 at 21:15

7 Answers7

27

You can read these:

android.os.Build.MANUFACTURER 
android.os.Build.MODEL

On a Kindle Fire these return the values 'Amazon' and 'Kindle Fire'.

http://developer.android.com/reference/android/os/Build.html

That should be sufficient for your app to make a determination that it's running on a Kindle Fire.


UPDATE:

The preceding works for the gen 1 Kindle Fire.

Newer models of the Kindle Fire have different values for android.os.Build.MODEL.

https://developer.amazon.com/sdk/fire/specifications.html

spencer7593
  • 106,611
  • 15
  • 112
  • 140
6

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".

Older apps will still return null, and I haven't actually verified the API or whether installing the new Store and then upgrading an older app will set the installer. But installing a new app and checking /data/system/packages.xml indicates installer is correctly set.

mttmllns
  • 1,740
  • 1
  • 15
  • 13
5

Be sure to update the Build.MODEL check to handle the new Kindle Fire devices.

  • KFOT = Kindle Fire
  • KFTT = Kindle Fire HD 7"
  • KFJWI = Kindle Fire HD 8.9" Wi-Fi
  • KFJWA = Kindle Fire HD 8.9" WAN

These are listed on the bottom of the chart at https://developer.amazon.com/sdk/fire/specifications.html

Catalin Morosan
  • 7,897
  • 11
  • 53
  • 73
Nick Bradbury
  • 1,745
  • 13
  • 14
  • 1
    To give this context in late 2013: these are the *2nd*-generation model IDs, but the link covers all to date. – mklement0 Dec 16 '13 at 16:05
4

Detecting a Kindle Fire is part of the solution, but not the whole solution. The (current) last post in this thread seems to get to the core of "was this installed from the Amazon store" -- which may well be a Kindle Fire, or not!

<snip, slightly edited>

The correct way to determine if an app is installed via Appstore in production mode is by using the onSdkAvailable(boolean isSandboxMode) method.

Documentation on onSdkAvailable(boolean isSandboxMode) method. Abstract:

  • This callback is invoked once you register your PurchasingObserver with the PurchasingManager
  • This method tells you if the Purchasing Framework is running in sandbox mode with test data, or in production mode with real data
  • If your app is downloaded via the Amazon Client, isSandboxMode will return false
  • The initiating method should be called within the onStart() lifecycle method

On registering your PurchaseObserver, you get a async call back, onSdkAvailable(Boolean isSanboxMode). If the app is downloaded via the Amazon Client then isSandboxMode will always return false. This code will work successfully in production mode, however in development/test environment, the isSandboxMode will always return true as the app is not downlaoded via the Amazon Client in test environment.

mm2001
  • 6,427
  • 5
  • 39
  • 37
  • I take it this only works if you're doing in-app purchasing? Any ideas how to do it without IAP? – Lawrence Kesteloot Nov 26 '12 at 05:52
  • No, sorry. Though I see an answer referencing "com.amazon.venezia" that would be a partial solution. This whole thing is tedious and error prone :( – mm2001 Dec 06 '13 at 23:29
3

I would just create 2 apps. One for Android. One for Kindle.

BlackHatSamurai
  • 23,275
  • 22
  • 95
  • 156
  • Not really necessary, since spencer's solution is really easy to apply. – Christian Brüggemann Jul 11 '12 at 21:23
  • 3
    The question is will Amazon accept that as a solution. I would guess they'd still reject it if it contains references to the Play store. For example, if someone downloads his app through the Amazon Appstore on a Galaxy Nexus, it's going to redirect to rate through Play. He should keep 2 versions. – Kevin Coppock Jul 11 '12 at 21:26
  • 2
    Yes, and no. What you have to remember is that just because it is an Android, doesn't mean that it is going to port exactly the same. You might find, now or in the future, that there are subtle differences in the way the app runs and/or appears. While his answer is simple and may serve you well, keep in mind that you may have to make changes that only affect the Android/Kindle. Best of luck! – BlackHatSamurai Jul 11 '12 at 21:26
  • 1
    @Blaine, you raise some important considerations. I only answered the question that was asked, "How can my app determine if its running on a Kindle Fire or not". – spencer7593 Jul 11 '12 at 21:33
  • @spencer7593, you're right. You did answer the question and you did it well. I think that is why you got so many votes! I voted for it myself, to be honest. I was just trying to add a little more to the wonderful answer that you provided. Food for thought, if you will. – BlackHatSamurai Jul 11 '12 at 21:37
0

You could include a link to a general webpage, and then the webpage could redirect the traffic to the Amazon AppStore or to Google Play.

For instance, you could include the link www.yourwebsite.com/getapp, which then would redirect traffic to Google Play or Amazon.

Amazon is unlikely to accept a Google Play link, even with a logic behind.

alexyes
  • 773
  • 2
  • 7
  • 14
  • This might work but the user then will be shown a browser first, right? And moreover you have to implement the same logic of deciding what OS is it. I guess it's still better to do in Android code. – Ilya Shinkarenko Jun 22 '14 at 11:11
0

Actually you can skip the check altogether and just link to market://details?id=packagename

Andreas
  • 529
  • 1
  • 6
  • 9