Android O Preview: What Developers Need to Know

The Android O Developer Preview dropped recently and the internet went nuts! The Developer Preview SDKs brought along many new features.

It’s that time of the year when Android Developers like you and me need to keep up with what’s latest.

I usually refrain from writing about Developer Previews, until a stable release arrives. But it’s better we get to know what’s new now. Rather than coping with changes in the future. So transitioning our apps to Android O will be smooth when the time comes.

icon icon

Trying Android O with Android Studio EAP

Android Studio EAP (Canary Channel) Credits: tools.android.com

In this post, we’ll first see how to setup Android Studio Preview. We need this to try out the new Android O Developer Preview SDKs. This is the first release, so I’m going to stick to calling it Android O DP1.

Using Android O DP1 requires Android Studio 2.4 EAP (Early Access Preview). Don’t worry as I’ll walk you through that as well. We’ll install Android Studio EAP in parallel to your existing Android Studio. So nothing will get affected.

Next, we’ll install the Android O Preview SDKs. This includes the Preview SDKs itself, Support Libraries and a System Image.

Android O release schedule. Credits: developer.android.com

Note:
I’ll be updating this post to be relevant to future Android O SDK releases.

Before setting up everything, let’s see what Android O has to offer.


Some of the biggest features in Android O are:

1. Picture-in-Picture (PIP) support for Android Mobile

PIP was first introduced in Android Nougat. It became famous by the floating video player in YouTube. Just add the attribute android:supportsPictureInPicture attribute in your tag in AndroidManifest.xml.

But, back then it was limited to Android TV. With Android O, they’ve finally brought it to smartphones as well. Goodbye DraggablePanel?

PIP in YouTube app

ISSUE:
Currently PiP does not work on Android O and fails with “IllegalStateException: Device doesn’t support picture-in-picture mode”. You can see the issue raised here.

2. Custom Font support

No need to use a library or write a custom View. Drop in your fonts to res/fonts folder. Then you can use them with a single attribute.

android:fontFamily="@font/Merriweather"

Finally we can start seeing apps with less of Roboto!

You can read the full tutorial on how to use custom font resources.

3. Autofill Framework

Users can save time filling out forms by using autofill in their devices

Long story short. Are you familiar with auto-filling forms in your web browsers? Remembering your passwords and credit card information to autofill it when required. That’s available on Android now. Sweet?

4. Notification Channels

Notifications are great. Every Android release made it better. But honestly, notifications are a spam-fest on our phones right now.

Notification Channels provide a unified system to help users manage notifications

In short, Notification Channels let you group your notification into broad categories. You can change the behavior of these broad notification categories in your settings.

Other little, but noteworthy changes

Adaptive Icons

Adaptive icons can help you integrate better with device UI, which can display a variety of shapes across different device models.

Honestly, I don’t get the point of this feature. It started with Nougat wanting to make every icon round. But now this.

Credits to android-developers.googleblog.com

ProgressDialog deprecated
Developer docs suggest a good UX tip. To use an inline ProgressBar in an Activity, instead of this modal dialog. But, you can take it a step further by using a better Progress Indicator called Skeleton Screen.

Text Justification
Spreads the typography over the full width. You just need one line and you’re good to go.

textView.setJustify(true);

Directional Attributes
No more padding top, bottom, left and right. Just paddingHorizontal and paddingVertical. Save yourself from writing two extra lines.

Credits to Cryil Mottier for this

OpenJDK Features for Android O
Some of the newly added packages include java.time and java.nio.file. You can read the complete Android O API differences report here.

Smart Sharing
Android O learns your preference and suggests relevant apps depending on what you’re sharing. For example, if you want to share a photo, Android might suggest social media apps.

Now we’re fully aware of what Android O has to offer. Time for us Android Developers to start preparing our apps for Android O.

icon icon

How to Develop for Android O right now?

To access the preview, you must first update to Android Studio 2.4.

A word of caution:
Keep in mind, we’re using an unstable IDE. Moreover, the Android O SDKs are still Release Candidates. Which means it’s the very first preview for us to give it a try. Expect to find bugs and even crashes! So if you do, be a good samaritan and report them to Google.

Also, since it is unstable, be sure to update your SDKs and IDE as soon as an update is available.

The official Android developer documentation explains how to setup Android O. I highly recommend you follow their guide first. You can safely install Android Studio Preview in parallel to your existing, stable Android Studio.

In short, nothing gets affected. Android Studio EAP will safely use your existing SDK path. Just install the new preview SDKs, download a system image and you’re good to go.

But just in case, here’s a quick checklist of everything you need to do:

  1. Download and install Android Studio 2.4 Preview (EAP)
  2. Next, install Android O preview SDK
  3. Download a preview image for emulator (Google APIs Intel x86 Atom System Image)
  4. Download and install SDK Build-Tools 26-rc1
  5. Create a new project targeting Android O Preview
  6. Check app/build.gradle if correct targetSdkVersion and Support libraries are used
  7. Create a new AVD targeting Android O
  8. Test your app by running it on the new AVD

The setup might look exhausting. But trust me, it took hardly an hour to do all that.

Moreover, developer.android.com does a good job of walking you through. It is fairly simple. But, if you get stuck anywhere, feel free to drop a comment here or send me a Tweet. I’ll be happy to help.


What’s next?

With Android Studio EAP setup, and the new SDKs downloaded, you’re good to go.

You can compile and test your apps against Android O. Check if everything works smoothly. Also, you can use this time to make your apps take advantages of the new features. For example, expect the Autofill Framework and Notification Channels to be widely used.

Even if you don’t want to support Android O right now, it’s okay. You can test drive the new SDKs and see what it has to offer.

So what did you like about Android O DP1? My particular favorite is the new font support.

What’s your favorite feature? Did I miss anything? Tell me in the comments below.

Also, in the coming weeks I’ll be covering each of these features. So don’t forget to subscribe below.

App developer with an eye for design. Loves to create apps with good UI/ UX that doesn’t annoy people. In his spare time, he likes to draw and paint.
Subscribe to Newsletter
Be the first to get latest updates and exclusive content
straight to your email inbox.
STAY UPDATED
Chill, I hate spam too. You can unsubscribe anytime.

Top Recommended Books by StackOverflow Users

Suleiman

App developer with an eye for design. Loves to create apps with good UI/ UX that doesn't annoy people. In his spare time, he likes to draw and paint.

You may also like...

Subscribe to Newsletter
Be the first to get latest updates and exclusive content
straight to your email inbox.
STAY UPDATED
Chill, I hate spam too. You can unsubscribe anytime.
JOIN !
Gradle setup, ProGuard rules, Material Design palette, metrics and much more

FREE Material Design Starter Project

For more details, click on the below link.
GET IT NOW FOR ANDROID STUDIO!
Download FREE
STARTER PROJECT
Material Design Template Project for Android Studio
DOWNLOAD STARTER PROJECT
Learn any Skill you like. Upto 95% discounts!

Learn what you love. Get Certified.

All Udemy courses at just $10.
FIND MY COURSE
Month end offer.
There's a multi-purpose app that can save your time coding. 
TELL ME MORE