Developing for Fire Tablets Running Fire OS 6

Fire OS 6 will be available on one or more Fire Tablet devices in Q4 2018. Prepare your app for compatibility with Fire OS 6 by following the guidelines below.

Fire OS 6 for Tablets

The Fire HD 8 (2018) tablet will ship with Fire OS 6. Fire OS 6 is based on Android Nougat (Android 7.1.2, level 25).

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 major changes include:

  • Check for permissions at runtime
  • 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. Remember not to use Google services on Amazon Fire Tablets. Instead, you must use the Apps & Games Services SDKs for the services you need (such as in-app purchasing). See Migrate from Google Play IAB v3.0 to Amazon IAP v2.0 for more details.

Notable new features include:

  • Adoptable storage
  • Doze/App standby

Adoptable storage

Customers can adopt external storage devices such as SD cards. Adopting an external storage device encrypts and formats the device to behave like internal storage. This feature allows users to move both apps and private data of those apps between storage devices. Adoptable storage may cause an app data directory to move around on external storage at runtime.

Doze/App standby

Doze and App standby aim to improve battery life by forcing device to sleep when user is not actively using it. This adds restrictions on Apps that want to do background processing and polling etc.

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 or Fire Tablets.

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.

Target 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. 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 Supporting Different Platform Versions.

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: