Identifying Amazon Devices (Amazon Fire TV)

Most Amazon Fire TV developers build apps for both Google Play and the Amazon Appstore, using the same Android-based code for both app markets and devices. Because Amazon devices don’t use Google services (they use Amazon services and APIs instead), you might need to target your code in different ways. Additionally, within Fire OS, there are two versions:

  • Fire OS 5: Based on Android 5.1 (Lollipop, API level 22)
  • Fire OS 6: Based on Android 7.1 (Nougat, API level 25)

If you have features only supported on API level 25, you will need to target this level in your code. This documentation provides details on identifying Amazon devices based on features, models, and API levels.

Reasons for Checking the Amazon Fire TV Device

You might want to check for the Amazon Fire TV device in your code for a number of reasons:

  • You have Nougat-specific (API level 25 and up) features that are supported only on Fire OS 6 devices.
  • You want to determine whether the app can play 4k Ultra HD.
  • You want to determine whether the app needs to tear down the DRM and HW decoding pipeline in their onPause() method (which is needed for Fire TV (Gen 1) due to limited handling of multiple DRM contexts).
  • You want to check whether the TV platform requires a D-pad controller to drive the UI.

Identify Amazon Devices by Feature and Model

You can identify Amazon Fire TV devices by looking for amazon.hardware.fire_tv as a feature. You can also use patterns in the android.os.Build.MODEL.

The following table provides a list of features and build models for different Fire TV devices:

Fire TV (Gen 3)
amazon.hardware.fire_tv
amazon.hardware.low_power
amazon.hardware.uhd_capable
(requires an Ultra HD TV)
amazon.software.drm_teardown
android.hardware.type.television
android.os.Build.MODEL AFTN
Fire TV (Gen 2)
amazon.hardware.fire_tv
amazon.hardware.low_power
amazon.hardware.uhd_capable
(requires an Ultra HD TV)
amazon.software.drm_teardown
android.hardware.type.television
android.os.Build.MODEL AFTS
Fire TV (Gen 1)
amazon.hardware.fire_tv
amazon.hardware.low_power
amazon.hardware.uhd_capable
(requires an Ultra HD TV)
amazon.software.drm_teardown
android.hardware.type.television
android.os.Build.MODEL AFTB
Fire TV Stick (Gen 2)
amazon.hardware.fire_tv
amazon.hardware.low_power
amazon.hardware.uhd_capable
(requires an Ultra HD TV)
amazon.software.drm_teardown
android.hardware.type.television
android.os.Build.MODEL AFTT
Fire TV Stick (Gen 1)
amazon.hardware.fire_tv
amazon.hardware.low_power
amazon.hardware.uhd_capable
(requires an Ultra HD TV)
amazon.software.drm_teardown
android.hardware.type.television
android.os.Build.MODEL AFTM
Fire TV Edition
amazon.hardware.fire_tv
amazon.hardware.low_power
amazon.hardware.uhd_capable
(requires an Ultra HD TV)
amazon.software.drm_teardown
android.hardware.type.television
android.os.Build.MODEL AFTRS
Fire TV Stick Basic Edition
amazon.hardware.fire_tv
amazon.hardware.low_power
amazon.hardware.uhd_capable
(requires an Ultra HD TV)
amazon.software.drm_teardown
android.hardware.type.television
android.os.Build.MODEL AFTT

All Fire TV devices can be identified through the feature amazon.hardware.fire_tv. You get the feature by calling the getPackageManager() method on the Context object and checking whether hasSystemFeature() returns com.hardware.amazon.fire_tv. The following code shows a sample:

final String AMAZON_FEATURE_FIRE_TV = "amazon.hardware.fire_tv";

if (getPackageManager().hasSystemFeature(AMAZON_FEATURE_FIRE_TV)) {
 Log.v(TAG, "Yes, this is a Fire TV device.");
} else {
 Log.v(TAG, "No, this is not a Fire TV device.");
}

You can also identify Fire TV devices by combining the android.os.Build.MODEL with the Build.MANUFACTURER (which returns Amazon).

However, as more Amazon-powered devices come to market with non-Amazon manufacturers, combining the android.os.Build.MODEL with the Build.MANUFACTURER may not always work. Because of this, include a sensible fallback approach for future Amazon Fire TV devices based on the com.hardware.amazon.fire_tv feature. Here’s a code sample that looks for the model but falls back on the feature:

final String AMAZON_FEATURE_FIRE_TV = "amazon.hardware.fire_tv";
String AMAZON_MODEL = Build.MODEL;

if (AMAZON_MODEL.matches("AFTN")) {
 Log.v(TAG, "Yes, this is a Fire TV Gen 3 device");
} else if (getPackageManager().hasSystemFeature(AMAZON_FEATURE_FIRE_TV)) {
 Log.v(TAG, "Yes, this is a Fire TV device.");
} else {
 Log.v(TAG, "No, this is not a Fire TV device");
}

Check for the API Level

To account for different behavior between Fire OS 5 and Fire OS 6 devices, you can check for the API level using SDK_INT. The following code checks whether the version is greater than or equal to API level 25:

if (Build.VERSION.SDK_INT >= 25) {
 Log.v(TAG, "Yes, this is an API level 25 or higher device");
} else {
 Log.v(TAG, "No, this is not an API level 25 or higher device");
}

In this case, the code would target only Fire OS 6 devices (API level 25) and exclude any Fire OS 5 devices (API level 22). If you want to target only Fire OS 5 devices, you would use a similar logic:

if (Build.VERSION.SDK_INT <= 22) {
 Log.v(TAG, "Yes, this is an API level 22 or lower device");
} else {
 Log.v(TAG, "No, this is not an API level 22 or lower device");
}