Android O, 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.
All links point to the Android developer preview site and are subject to change once O is officially released into the wild—we’ll update these as they change so you don’t miss out on anything.
Apps Targeting All API Levels
Consider the following behavior changes that will take place even if your app doesn’t target O just yet.
- Android O limits how frequently background apps can retrieve the user’s current location. In Preview 3, it is a few times per hour, but that is subject to change in the final O release
- ANDROID_ID now varies per user, app signing key, and device
- hostname system property produces a null result for the sake of privacy
- The framework will set a focus state drawable for your focusable views if you haven’t defined any
- If you implement a custom Thread.UncaughtExceptionHandler, make sure you call through to the default handler
- removeAll() and AbstractCollection.retainAll() now always throw a NullPointerException. Check your app for any usage of these APIs
- 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.
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. Read more on this on 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.
- 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
- 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 Developer’s blog post
- Test any code paths in your app executing sort() and Lists.sort() due to internal changes in O
- 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 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
- 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
- Clickable View objects are now also focusable by default
The full list of Android O behavior changes can be found here.
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.
Want even more insight on Android updates and their impact on brand experiences? As one of only 25 global Android Certified Agencies, we’re always thinking ahead for our clients. Ask your questions at [email protected].