Vielen Dank für Ihren Besuch. Diese Seite ist momentan nur auf Englisch verfügbar. Wir arbeiten an der deutschen Version. Vielen Dank für Ihr Verständnis.

Developing for Amazon Fire TV Devices Running Fire OS 6 (Amazon Fire TV)

Amazon Fire TV devices running Fire OS 6 are based on Android Nougat. You can ensure your app’s compatibility on Fire OS 6 by following the guidelines here.

Devices Running Fire OS 6 versus Fire OS 5

Amazon Fire TV Gen 3 runs on Fire OS 6, which is based on Android Nougat (Android 7.1.2, level 25). However, previous Fire TV devices (Fire TV Stick Gen 1 and 2, Fire TV Gen 1 and 2, and Fire TV Edition) remain on Fire OS 5 (which is based on Lollipop, or Android 5.1, level 22, and some backported Marshmallow). At this time, the previous Fire TV devices will not uplevel to Fire OS 6.

Behavior Changes and New Features with Android Nougat

Android Nougat introduced some changes from Lollipop and Marshmallow that you will need to account for in your app on Fire OS 6 devices. You can read about these changes in Android 7.0 Changes and Android 6.0 Changes. Some notable changes include checking permissions at runtime and linking to private libraries.

Check for Permissions at Runtime

As always, normal and dangerous permissions required by your app need to be declared in your app’s manifest (through the uses-feature) and uses-permission elements). However, for API level 23 and higher devices, permissions need to be checked at runtime, per Android’s guidelines — see Working with System Permissions, specifically Requesting Permissions at Run Time.

Checking permissions at runtime was a feature introduced in Marshmallow (API level 23) to streamline the installation and update process as well as give users more control over the app. Note that because of runtime permissions, users will be able to revoke individual permissions when prompted. You must handle scenarios where the user revokes the permission.

Also, if you have a single binary targeting multiple devices (both Fire tablet and Amazon Fire TV devices), avoid requesting permissions in your manifest for features that don’t exist on those devices (for example, asking for gyroscope permissions on a Fire TV app). See Handle Unsupported Hardware Features for more details.

Linking to Private Libraries

Android Nougat does not allow apps to dynamically link to non-NDK or private libraries. Your app must include any required libraries in your APK, or you must use the public NDK APIs instead. For more details, see Opening shared libraries directly from an APK and Private API (Enforced for API level >= 24).

Fire OS 6 Parity with Nougat

All features in Android Nougat are supported on Fire OS 6. Some of Nougat’s TV-specific features supported on Fire OS 6 include the following:

See the Android documentation for details and instruction about coding for these features.

Remember that although Fire OS 6 has parity with Nougat, you can’t use Google services on Amazon Fire devices. Instead, you must use the Apps & Games Services SDKs for the services you need (such as in-app purchasing). See Amazon Fire TV Development Versus Android TV Development for more details.

Targeting Your App for Fire OS 5 and Fire OS 6 Devices

To maximize compatibility with Fire OS 5 and Fire OS 6 features, you need to target devices accordingly. You can identify Fire TV Generation 3 devices using AFTN as the Build.Model. However, it will be more efficient to target the SDK level. In your code, you can check whether the Build.VERSION.SDK_INT is greater than or equal to 25 (Nougat’s API level) to target Fire OS 6 devices. See Identify Fire TV Devices for more details. See also Supporting Different Platform Versions.

Testing your App’s Compatibility on the New Amazon Fire TV Devices

Currently, there’s no way to test your app’s compatibility with Fire OS 6 devices unless you have an actual device to connect to. The App Testing Service, which provides only minimal compatibility testing, won’t tell you if your app is compatible with Fire OS 6 devices. However, if you submit your app through the standard app submission process, the Appstore team will indicate any specific reasons for app failure. Currently, apps compatible with the current Amazon Fire TV devices are compatible with the new devices as well.

Remove uses-amzn-sdk from App Manifest

For both Fire OS 5 and Fire OS 6 devices, one tag you should remove from your app’s manifest is <uses-amzn-sdk>. This tag relates to the old Fire OS SDK add-on. Check to see if you declare <uses-amzn-sdk> in your AndroidManifest.xml file. If so, remove this tag (and any dependencies on it in your code). The <uses-amzn-sdk> tag is no longer used in apps on Amazon Fire TV.

Although your app will still work on Fire OS 6 devices with this tag in your manifest, removing it will avoid any future incompatibilities. None of the components of the old Fire OS SDK add-on are required to develop apps for Fire devices. Instead, use standard Android APIs and the Amazon Apps & Games Services SDKs.

Game Apps Developed with Older Versions of Unity

If you have a game app developed with an older version of Unity (such as Unity 4.5 or 4.6, when UnityPlayerNativeActivity was the default activity), your game might have a 1-2 second blank white screen before the game loads for the very first time in the memory. The issue is due to Android N’s cold start while the app loads to memory (and waits for all the work to be completed). This issue happens for all Nougat devices and is not specific to Fire OS 6.

To fix the issue, upgrade to the latest version of Unity. If upgrading is not an option, you can try updating your Android Manifest file by changing UnityPlayerNativeActivity to UnityPlayerActivity, available since Unity 5.0b12. For more information, see Android Manifest in the Unity documentation.

Best Practices for Media Playback to Preserve Resources and Memory

Some apps on Amazon Fire TV (Gen 3) fail because they do not handle media playback properly. (This is unrelated to Fire OS 6, but it is a best practice to follow for both Amazon and Google apps.) Because the media playback resources in Amazon Fire TV are hardware-based and memory constrained, your app must be well-behaved and release the media resources when you are done with them.

Specifically, apps that play video should pause playback and must release all media resources such as decoders immediately in your onPause() method. See Releasing the Media Player and MediaPlayer.release() for details.

If your app plays video through an Android WebView (with the <video> HTML tag), hardware media resources are not currently released by the system when your app pauses or stops. To work around this issue, explicitly release these resources by killing the processes when you implement your onPause() and onStop() methods:

public void onStop() {
   super.onStop();
   android.os.Process.killProcess(android.os.Process.myPid());
}

For more details, see the following:

What to Set for minSdkVersion and targetSdkVersion

In general, set your minSdkVersion to 22 or lower (set it to the minimum API level your app needs). This will make your app available to all Amazon Fire TV devices (running both Fire OS 5 and 6). Set the targetSdkVersion to the highest API level that you’ve tested your app against.

Here’s some more background on these settings. In your app manifest (or build.gradle file), the minSdkVersion attribute sets the minimum SDK level that your app needs in order to function properly. (Devices that don’t support that API level shouldn’t allow the app to be installed on that unsupported device.)

Fire OS 5 devices are based on API level 22 (Lollipop 5.1). Fire OS 6 devices are based on API level 25 (Nougat 7.1). By setting the minSdkVersion to 22, you’re saying that your app requires the device to have at least API level 22 for it to function properly.

In setting the minSdkVersion to 22, your app will also install on any devices that have a higher API level (such as 25), because Android levels are backwards-compatible. API level 25 usually includes all the APIs for levels 1 through 25 (each release adds to the previous).

However, suppose you want to take advantage of APIs in Nougat (API level 25). If you set your minSdkVersion to 22, your app will install on Fire OS 5 devices that don’t have level 25 APIs. Therefore, you must code in a defensive way to check the device level and fall back to alternatives if the device doesn’t support that API level. Your code might look something like this:

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");
}

This code checks whether the device’s API level is greater than or equal to 25, and if so, runs the code. If not, it falls back on else logic.

By default, if the targetSdkVersion is not specified, it uses the same value as the minSdkVersion. The targetSdkVersion lets you set the latest API level that you have tested your app against. Based on this value, Android will ensure proper behavior on devices at this level.

For example, if you set your targetSdkVersion to 23 or higher (Marshmallow’s release), Android will apply the runtime permission checking features included in Marshmallow. But if targetSdkVersion is lower than 23 (prior to the runtime permission checking release in Marshmallow), Android will not apply this behavior to your app.

You should test your app on a Fire OS 6 device prior to setting the targetSdkVersion to 25.

The maxSdkVersion attribute isn’t recommended, but if you wanted to make your app available only on on Fire OS 5 devices, you could set the maxSdkVersion to 22. If you wanted to make your app available only on Fire OS 6 devices, you could set your minSdkVersion to 25.

For more information, see the following:

AV Sync Issues with Custom Media Players

AV sync refers to video that’s not quite in sync with the audio (voices don’t match mouth movements). If you’re using ExoPlayer or the standard Android MediaPlayer, you won’t experience AV sync issues. But if you’re using a custom-made media player in your app, the audio and video (AV) might become slightly out of sync. (This issue isn’t specifically related to Fire OS 6 but rather is a general best practice when developing apps for Fire OS devices.) For details on how to eliminate AV sync issues, see Audio and Video Synchronization.

Support

If you notice any issues with your app on Fire OS 6, note the issue in the Amazon Fire TV and Fire TV Stick forums.