Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to distinguish if the Android app runs on Amazon Kindle Fire?

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?

like image 311
Ilya Shinkarenko Avatar asked Jul 11 '12 21:07

Ilya Shinkarenko


2 Answers

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

like image 67
spencer7593 Avatar answered Oct 16 '22 22:10

spencer7593


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.

like image 39
mttmllns Avatar answered Oct 16 '22 21:10

mttmllns