Skip to main content
Preparing for Android O

Preparing for Android O

·927 words·5 mins·
Jared Stockton
Author
Jared Stockton
Solving Mobile Business Problems through Architecture, Documentation, Mentoring, and Collaboration
Table of Contents

Android O (aka Oreo and 8.0), the upcoming OS for Android revealed at this year’s Google I/O, features many updates that developers are excited about. But you shouldn’t wait until its release to begin thinking about how O will affect your current or future apps. Let’s look at what you can prepare for right now before Android O’s release. Before you dive in, we should explain that we’re not reviewing what’s new for users here — this post is a rundown for Android developers. So let’s talk code!

We’ve divided the subject into two main sections. The first section deals with apps that target any API level and reveals changes that your app will see even without targeting Android O. The second section deals with new APIs and behavior changes when targeting Android O. Both of these sections assume that your app is running on an O device.

Apps Targeting All API Levels
#

Important Changes
#

Consider the following behavior changes that will take place even if your app doesn’t target O just yet.

Other Observations (app not targeting O yet)
#

  • On O devices, Notification badges (aka notification dots) are displayed by default (on supported launchers).
  • In Android O, Developer Options > Show Layout Bounds now displays an “X” icon over the element that currently has focus.

The full list of changes can be found here.

Testing (app not targeting O yet)
#

You’ll basically want to test out your app on a device with the O Preview or an emulator focusing on system behavior changes and going through all app flows. Find additional details at the Android developer site.

Apps Targeting O (API 26)
#

Changes requiring action
#

Consider the following behavior changes that you will need to handle (if they affect your app).

Background execution limits
#

Check out your strategy around background execution considering the following changes:

  • Apps cannot use their manifests to register for implicit broadcasts. You must register for them at runtime.
  • Apps that are running in the background now have limits on how freely they can access background services.
  • Wakelocks are removed when the app is backgrounded with no active components (components being an activity, service, broadcast receiver, or content provider).

By default, these restrictions are enabled when targeting O, but the user on an O device can still enable them from Device Settings even if you don’t target O.

Other Changes
#

  • Notification channels are mandatory. You are required to add at least one notification channel for your app. If you don’t, no notifications will be shown and the system will log an error. To see a Toast when this happens on your O test devices, turn on Settings -> Developer options -> Show notification channel warnings. Find additional info on notification channels here.
  • Set a maximum aspect ratio. The app’s default max screen aspect ratio is no longer set to 1.86 (16:9) when you set your target sdk to 26. Make sure to set a default aspect ratio meta-data entry in your manifest and test your app on the Samsung Galaxy S8 or LG G6. Read more on this Android Developers Blog post.
  • Test any code paths in your app executing sort() and Lists.sort() due to internal changes in O.
  • net.dns1, net.dns2, net.dns3, and net.dns4 are no longer available in O.

Optional (but Recommended) Changes#

The following is a list of things you are free to implement (or not) in your app. Doing these things is not required but will result in a better experience on O devices.

  • Provide hints on input views (username, password, address, etc) and mark them as important for AutoFill to help the AutoFill framework better understand your app.
  • Consider supporting Picture-In-Picture (PIP) mode if your app focuses on a media playback experience. Note that android:resizableActivity isn’t required to be set if you only want to support PIP and not other multi-window modes.
  • Add adaptive launcher icons. Check out the AdaptiveIconPlayground app mentioned here and on GitHub to test how your adaptive icons respond to various masks and demonstrate possible animations using your adaptive icon.
  • Consider adjusting your App’s UI to let the user pin app shortcuts and widgets rather than relying on the user manually adding them from their Launcher. See more info here.
  • If you really want to make your Chromebook users happy, consider adding keyboard navigation clusters to your views and viewgroups.
  • Consider using Google’s Safe Browsing API on all your WebViews by adding a meta-data entry to your manifest.

Other Observations
#

The full list of Android O behavior changes can be found here.

Testing
#

You’ll basically want to test out your app on a device with the O Preview or an emulator focusing by targeting O, addressing system behavior changes, implementing O specific features and going through all app flows. Learn more on migrating apps to Android O on the Android developer page.


Thanks for reading!