Migrating to Android 8.0

Android 8.0 (API level 26) introduces behavior changes as well as new features and APIs that
you can take advantage of in your apps. This document gives you an overview of the steps to migrate
your apps to Android 8.0 across two key phases:

When you are ready to take advantage of the new features of
the platform, update your targetSdkVersion to 26, verify the app continues
to function as expected, and then begin using new APIs.

Ensure compatibility with Android 8.0

The objective here is to make sure that your existing app works as-is on Android 8.0
(API level 26). Because some platform changes might affect the way your app behaves,
some adjustments might be necessary, but you do not need to use new APIs or
change your targetSdkVersion.

However, there's another aspect to testing: Android 8.0 introduces changes to the Android
platform that can affect your app's behavior or break the app altogether, even if you do not change
your targetSdkVersion. For this reason, it is important that you review the key changes
in table 1, and test any fixes that you implement to accommodate the changes.

If your app receives location updates from a background service, it receives less frequent
updates on Android 8.0 (API level 26) compared to older versions of Android. Specifically, a background
service cannot receive location updates more than a few times per hour. However, while your
app is in the foreground, the rate of location updates is unchanged.

Update your target version and use Android 8.0 features

This section explains how to enable full support for Android 8.0
(API level 26) by updating your targetSdkVersion to 26
and adding new features available in Android 8.0.

In addition to offering you new APIs, Android 8.0 introduces some behavior
changes when you update your targetSdkVersion to 26. Because some behavior changes
might require code changes to avoid breakage, you should first understand how your app might be
affected when you change the targetSdkVersion by reviewing all behavior changes for apps targeting Android 8.0.

Note: The steps described above to
ensure platform compatibility are prerequisite
to targeting your app to Android 8.0, so be sure you complete those steps first.

Get the Android 8.0 SDK

You can get the SDK packages to build your app with Android 8.0
(API level 26) using the latest version of
Android Studio (Android Studio 3.0+ is recommended).
Android Studio 3.0+ includes tools to help you with Android 8.0 features
such as adaptive icons and
downloadable fonts.
If you don't need those features yet, then you can use the stable version of Android Studio
2.3.3 to build your app with Android 8.0 and use the new APIs.

To get set up with either version of Android Studio, follow these steps:

Remove broadcast receivers from your manifest file

Because Android 8.0 (API level 26) introduces new
limitations
for broadcast receivers, you should remove any broadcast receivers that are
registered for implicit broadcast intents. Leaving them in place does not break your app
at build-time or runtime, but they have no effect when your app runs on Android 8.0.

Explicit broadcast intents—those that only your app can respond to—continue
to work the same on Android 8.0.

There are exceptions to this new restriction. For a
list of implicit broadcasts that still work in apps targeting Android 8.0, see Implicit Broadcast Exceptions.

When you build your app with the targetSdkVersion set to 26,
there are specific platform changes you should be aware of. Some of
these changes can significantly affect your app's behavior or even
break your app altogether, even if you do not implement new
features in Android 8.0.

Table 2 provides a list of these changes with links to more information.

Table 2. Key changes that affect apps
when targetSdkVersion is set to 26.

Change

Summary

Further reference

Privacy

Android 8.0 (API level 26) does not support use of the
net.dns1, net.dns2, net.dns3, or net.dns4 system properties.