Top 3 Android O Features & Functions For Developers
11 Aug. 2017 Mobile App
In less than a month after releasing the third developer preview of Android O, Google is back rolling out yet another version of the OS. The company just dropped the fourth developer preview for beta devices, marking a stable release of the Android Support Library.
And customarily, the preview is available for the Pixel, Pixel C, Pixel XL, Nexus 5X, Nexus 6P, Nexus Player, and the Android Emulator.
Android O For Developers
The Android O Timeline
As per the timeline below, the final build of Android O will be rolled out by the end of 2017. The fourth developer preview is however, an opportunity to test and publish your updates to help end users transition smoothly to Android O.
The latest preview comprises near-final device system images and stable version of the Android 26.0 support Library. Incremental SDK improvements, tools and system images of the Android Emulator are yet to be released. So, while Google prepares to roll out Android O officially, let’s learn about the new Android O features the company has brought to the platform for developers.
New Features & Updates In A Nutshell
Android O brings an array of new features and capabilities for developers. Here are three important Android O features and functions that will delight developers and help them build more interactive apps for consumers.
#1 – Autofill Framework:
Creating accounts, logging into multiple websites, and processing online payments are often prone to errors. These type of tasks require redundant efforts which can leave users frustrated. The Autofill Framework in Android O simplifies this by allowing users to automatically fill out forms like login, profile pages, and credit cards. However, this feature will only be activated when users opt into autofill for auto filling the web forms. Developers building application that requires auto-filling capabilities can optimize their app to seamlessly work with the autofill framework.
#2 – API Changes:
Android O comes with a new object called PictureInPictureParams. You need to pass this object to PIP (a type of multi-window mode used for video playback) methods to specify how a particular activity must behave when it is in PIP mode. The PictureInPictureParams objects specify properties such as a preferred aspect ratio of an activity. Developers can use the existing PIP methods on all Android devices except Android TV.
Additionally, Android O supports the PIP mode with the following methods:
Activity.enterPictureInPictureMode(PictureInPictureParams args): It places the activity in picture-in-picture mode. The aspect ratio of the activity and other configuration settings are specified by args. If any field in ‘args’ is empty, the platform utilizes the values you set the last time you called Activity.setPictureInPictureParams().
The specified activity is then placed in a corner of the screen. The remaining space of the screen is covered with the previous activity that was on screen. The activity that enters the PIP mode goes into a paused state while being active. If the PIP activity is clicked by a user, the system displays a menu a user can interact with. Note that none of the events reach the activity while it is in the PIP mode.
Activity.setPictureInPictureParams(): First, update the PIP configuration settings of an activity. If it is in a PIP mode currently, the settings are updated. This is useful if the aspect ratio of the activity changes. If the activity is not in the PIP mode, the configuration settings are used irrespective of the enterPictureInPictureMode() method you call.
#3 – Unified layout margins & padding:
With Android O, it is easier to specify situations where opposite sides of a View element uses the same margin or padding. To be specific, the following attributes can be used in your layout XML files:
- layout_marginVertical – this defines both layout_marginTop and layout_marginBottom at the same time
- layout_marginHorizontal – this defines both layout_marginLeft and layout_marginRight at the same time
- adding vertical – this defines both paddingTop and paddingBottom at the same time
- paddingHorizontal – this defines both paddingLeft and paddingRight at the same time
Apart from these, Android O includes several other improvements such as support for various OpenJDK Java APIs, additional support for instrumentation tests, UI tweaks, new security and privacy permissions, new accessibility features and more.
To try the new Android O developer preview for yourself, head to developer.android.com and download the factory image for your device. You can also sign up for the Android Beta Program to receive an OTA (over-the-air) update for the next build.