Android Oreo Tightens Up Some Screws, Adds Polish to Google’s Platform
Read about the upgrades and new features in Android's new Oreo OS, and how to prepare for them as a mobile app developer.
Join the DZone community and get the full member experience.Join For Free
On a broader note, Android releases can be bifurcated into categories: "Overhauls" and "Improvements." Every "overhaul" is followed by a "improvement" release and vice versa. Android Lollipop was an overhaul while Android Marshmallow was an improvement over it.
Likewise, Android Oreo is more of an improvement over Android Nougat, although Oreo brings a lot of cosmetic and under-the-hood changes. The biggest takeaways are Picture-in-Picture, Notification Channels, Autofill, and Project Treble.
In addition, there are tons of minor changes and under-the-hood changes that’ll make the mobile OS boot faster, return a better battery life, and receive faster updates.
I will discuss all of these features, starting with features that are being introduced to Android with Oreo and weren’t available before.
Picture in Picture (PIP) Mode
Android Oreo allows app activities to launch in PIP mode. Google introduced split screen with Nougat. With Oreo, it has taken the multitasking capabilities of Android devices to a whole new level.
Android Oreo will keep showing the content even when a user has switched to a different app. A YouTube video or a Skype call will continue to play on the bottom-right of the screen. The user can click the PIP window to switch to full screen.
An app in Android Oreo should not pause playback in its onPause() handler, but on onStop(), and resume playback in onStart(). To use PIP mode, set android:supportsPictureInPicture to true and android:resizeableActivity to false.
Android Oreo lets developers channel notifications their app sends to their users. Up until now, notifications in Android were channelized as per the app they belong to. That is, Gmail and WhatsApp notifications will remain in their respective windows in the notification pane.
An Android app sends all types of notifications to the device. Twitter for Android, for example, sends three types of notification: Direct Messages, New Followers, and Tweets from People You Follow.
Importance: Urgent will make a sound and show on the screen. High makes a sound. Medium makes no sound. Low makes no sound and gives no indication that it’s been received.
Sound: Set any supported sound as the notification tone for the channel.
Lights: Whether the notification should trigger a hardware notification light.
Vibration: Whether the notification should vibrate your phone.
Show on lock screen: Decide if a notification should appear on the lock screen.
Override do not disturb: Decide if a notification should bypass any do not disturb settings for sounds.
Moreover, a user can block a channel or an app from sending notifications altogether.
Android mobile app developers can create an instance of NotificationChannel for every type of notification they need to send. Moreover, they can create NotificationChannelGroup().
Also read, update, and delete channel settings: getNotificationChannel(), createNotificationChannel() and deleteNotificationChannel().getNotificationChannel(), createNotificationChannel(), and deleteNotificationChannel().
Android Oreo lets you snooze notifications just like you snooze your alarms. Available snooze times are 5 minutes, 30 minutes, one hour, and two hours. To snooze, swipe right on a notification, tap the clock icon, and select the time. Many a time, you have to dismiss a notification because the notification pane no longer has room for it. By snoozing, you get rid of it for the time being, not permanently. This video demonstrates:
An app should work fine with snoozing notifications introduced with Android 8.0 without the need of modifying underlying code.
Notification Badges and Long Press
A bit like iPhones, Android will show a dot over an app if it has an unseen notification. However, Google took the experience to a new level. Remember, Google introduced "App Shortcuts" with Android 7.1.1–long press an app icon to access key functions within the app.
Well, with Android 8.0, "App Shortcuts," or the long-press menu, also shows any unseen notifications pending in the app.
The setShowBadge() method overrides the OS setting and stops notifications from a channel being reflected by a badge in an app.
The latest version of Android lets app developers display rich media notifications: playback controls, album art, and a color other than white. Google Play Music and YouTube can display notifications in color.
Developers can set a desired background color using setColor(). setColorized() enables the use of color for a notification.
Users easily get frustrated with repetitive tasks of filling forms whenever they have to sign-up for a new service or log in to an existing. With Android Oreo, autofill is making a comeback in the mobile space. Remember, Internet Explorer?
Users can enable or disable autofill as well as change the autofill service in Settings > System > Languages & input > Advanced > Input assistance > Autofill service.
Apps that use standard views work with the Autofill Framework out of the box. However, you can take some steps to optimize how your app works with the framework.
For more information, see the Autofill Framework Overview.
A new Android release goes through various stages before it can reach a user’s device.
With Project Treble, Google is re-architecting the way new Android releases reach a user’s device. Project Treble will result in easier, faster and less costly updates for Android Vendors, and thus, faster updates to users.
Project Treble, subject to vendors' approval, will be a part of every new device launched with Android O and beyond. Project Treble architecture is a part of the Developer Preview of O for Pixel phones.
The Bad News (at Least for Developers)
With Android 6.0, Google introduced “Doze” mode. “Doze On-the-Go” enhancements were added in Android 7.0.
In Oreo, Google has put even more limitations what apps can do while they’re running in the foreground. One of the key limitations is broadcast limitations. Android 8.0 apps can’t react to broadcasts that are not intended for them. Google developers are sure not gonna be happy about them.
Android developers have to switch to Android's Job Scheduler, introduced in Lollipop, which manages background tasks in a way that’s not harder on the battery.
On the surface, this may seem like a safe Android release—evolution, not revolution. Oreo devices and updates will start appearing around 2018, unless you’re on Pixel or Nexus. Things may improve around the time of Android P with the introduction of Project Treble with Android Oreo.
Published at DZone with permission of Shahid Mansuri, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.