What’s new for Developers in Android Oreo?

Whats new for Developers in Android Oreo
Android Oreo

Android

What’s new for Developers in Android Oreo?

What’s new in Android Oreo for Developers

Android Oreo is here and available to consumers. Hopefully, you’ve taken the opportunity to test and update your apps during the long preview process so those influential, vocal early adopters have a great experience. Let’s review what O brings.

The most important stuff first.

Behavior Changes

You should keep in mind that even if your app doesn’t yet target O, it will behave differently on O in a few ways.

  • Background Location Update

When your app is in the background, i.e. without an active activity or foreground service, location updates will be significantly less frequent.

  • Wake Lock Released

When your app no longer has an active activity, service, or other component any wake locks at hold will be automatically released.

  • Setting.secure.ANDROID_ID

For devices that come with Google Play services, settings not secured on Android ID will return a different value for each app based upon the sign-in key and user profile. For advertising, you really need to be using Google Play services user-re-settable advertising ID.

Account Changes

Here’s another privacy-related change. Apps targeting O won’t be able to get access to user accounts using the get accounts permission. Instead, apps must rely on the account user activity.

Account owners can now choose whether their accounts will be visible to other apps and the account user activity will be updated accordingly.

Background Execution Limits

If you’re targeting O, your app will have new limits on background processing. In summary, only a small number of broadcasts can be used to start your app, such as ACTION_BOOT_ COMPLETED  and ACTION_LOCALE_CHANGED .

Also, your app will no longer be able to start services when in the background. You’ll need to rely on explicit broadcast receivers, JobService, Firebase Cloud Messaging, and startForeground API, a new API to start foreground services.

Wide Gamut Displays

Android Oreo adds features to support wide gamut displays, including 16-bit PNG and ICC profiles, JPEG, PNG, and WebP, along with new utilities such as color space and color log.

Longer Narrower Screens

Android O also supports a longer, narrower screens, and apps that target Android O no longer have a default maximum aspect ratio of 1.86. If your activity needs to set a maximum aspect ratio, the system will letterbox your app if you set resizeable activity to false and use the max aspect ratio attribute.

Of course, it’s best to make your app work full screen and with multi-window, so only use this as a last resort.

Updatable Graphics Drivers

To make it easier to correct graphics driver issues, Android O device manufacturers may choose to update these drivers in the Play Store without having to do a system update. And of course, Android O is built on Project Treble, so devices that ship with O will be easier to update to new versions of Android in future.

Notification Channels

Android Oreo gives users fine-grain control over notifications by adding notification channels. Apps can declare channels, which show up to users as categories. Users can block a category and alter its behavior controlling vibration, lights, and lock screen privacy. Apps can target Android O must use channels if they use notifications. We call the notification manager to create notification channels.

And then we set the notification channel ID in the compact notification builder.

NotificationCompat.Builder(context, chanId);

Android O also supports notification badging and dots by default in a channel. We can turn this off by setting set show badge to false.

App Widget Pinning

Android Oreo now allows apps to request adding their AppWidget to the launcher. You can easily check to see if AppWidget pinning requests are supported by the default launcher and then have your app request them in your UI.

Shortcut Pinning

We’ve changed the way adding shortcuts works, eliminating the broadcast used in Android 7.1. Similar to AppWidgets, you can check to see if shortcut pinning requests are supported and then have your app request them.

Picture in Picture

Picture in Picture is now available for all devices, not just Android TV. To specify if your activity can use PiP mode, set supports Picture in Picture to true in the manifest.

All an app has to do to start Picture in Picture is call enter Picture in Picture mode from a resumed or pause state.

Activity.enterPictureInPictureMode(PictureInPictureParams args);

Multi-Display

Activities can now be launched by the app on secondary displays using activity options, simpler and easier than the presentation API. In addition, activities that support multi-window can be launched by a user on secondary displays. These displays have per display based configurations and resource management. This means that some parts of the configuration, such as screen width DP, screen high DP, layout, and density DP will be set according to display on which the activity currently resides.

Fonts

Fonts now are a fully-supported resource type in Android O and have also been back-ported to API 14 in the support library. You can use the get font method to get a font by ID and use these fonts directly in text views.

Typeface font = mResourceCompat.getFont(R.font.myfont);

You can also define entire font families in XML , declaring the font styles and weights, along with the font resource.

Downloadable Fonts

Downloadable fonts are also supported in O and implemented in the support library. These fonts are shared between applications, making better use of storage. The 800 plus Google Fonts are now available directly within Android Studio, where they can either be embedded in your ABK or set to download on-demand.

TextView AutoSizing

One of my favorite Android Oreo and support library features is TextView AutoSizing. You can create an array of preset text sizes or set min and max sizes with a step granularity and the text will grow and shrink to fill the available text view space.

EditText Autofill

EditText can now be autofilled. Much of this will happen automatically but you can help the Autofill provider do a better job by giving it hints.

You can also mark fields that Autofill should ignore.

Adaptive Icons

Adaptive icon support in Oreo allows app developers to control the way their icon appears with launchers and devices that use different icon shapes, with an additional layer that can be used for animated effects. Android Studio includes a new wizard for creating adaptive icons. And O has added support for fractional inset values to make it easier to use legacy resources to build these icons.

AAudio API

Android has a new native audio API, AAudio, designed for low latency tasks, such as effects processing and real-time synthesis. It’s easier to use and adds a new direct mode that if implemented by an OEM allows reducing latency.

There’s so much to discover in Android O, which also includes updates to playback and recording, seeking and reversing animator’s sets, multi-process web view is Safe Browsing, StrictMode enhancements, seek able file descriptors with media file access, more language support, and more.

Continue Reading
You may also like...

I am a Sr. Android App & Web Developer having 5 plus years of extensive hands-on experience in Object Oriented Programming, Database Design and Implementation using Agile & UML. Pro in Yii2 PHP Framework, Android App Development, MYSQL & a Blockchain enthusiast.

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

More in Android

Recent Posts

Categories

Tags

To Top