30

Does anyone know how to detect if the app is running on Kindle Fire ?

My app needs to turn off a few features if running on the Kindle Fire and I want to use the same build as Google Marketplace.

Chris
  • 1,637
  • 1
  • 14
  • 20

2 Answers2

41

You can read android.os.Build.MANUFACTURER and android.os.Build.MODEL. On a Kindle Fire 1st Generation they are 'Amazon' and 'Kindle Fire' respectively. For model codes of newer Kindle Fire devices, see Device and Feature Specifications on Amazon's developer site.

Matthias
  • 17
  • 4
Marek Stój
  • 4,075
  • 6
  • 49
  • 50
  • also check out https://stackoverflow.com/questions/19592927/is-it-possible-to-reliably-detect-at-runtime-which-store-installed-an-android-ap/19643816#19643816 to see if the apk was installed from the Amazon store – Offbeatmammal Nov 01 '14 at 06:07
38

Based on Amazon's Tablet Device Specifications I currently use this code:

public static boolean isKindleFire() {
    return android.os.Build.MANUFACTURER.equals("Amazon")
            && (android.os.Build.MODEL.equals("Kindle Fire")
                || android.os.Build.MODEL.startsWith("KF"));
}

According to that table the manufacturer string is always equal to "Amazon" and the model string is either "Kindle Fire" for the first 2011 model or it starts with "KF" for all subsequent models.

devconsole
  • 7,875
  • 1
  • 34
  • 42
  • 3
    So, just had an app rejected by Amazon because it was starting the Google app store, dependent on this test. Unfortunately I don't have the failing values of `Build.*`, but I resubmitted with `equalsIgnoreCase` in place of `equals` for the first two parts of the expression and the resubmission passed. So that may now be necessary. – nmr Jan 14 '14 at 22:14
  • @nmr - equalsIgnoreCase probably does not hurt but I am not convinced. Maybe they ran a test on a non-Kindle Fire device? AFAIK you can install their App Store on almost any Android device. I think you should check if Google Play is available in addition (or instead of) this test. – devconsole Jan 19 '14 at 20:37
  • Yeah who knows, Amazon isn't exactly a perfect actor, they may have tested on a non-Kindle even though I am relatively sure that I explicitly disallowed distribution on them. I really should do it the way you describe, but the way the code is written it will need some reorganization to support that. – nmr Jan 20 '14 at 19:04
  • 1
    Why bother checking the model? I would imagine most folks just need to see if it's an Amazon device so they can alter their app to not use any Google services. – withoutclass Aug 18 '14 at 17:37