Google team has announced the preview release of Android O, here are some changes for the developer with documentation and API differences.
- In new API changes, each page which is returned by the Content provider will be counted as a single Cursor object.
- Android O will allow you to customize the pairing request dialog when trying to pair with companion devices over Bluetooth, BLE, and Wi-Fi.
- There is a specific disk space for each app for caching data. You can get it using-getCacheQuotaBytes(File).
- Introduced OpenJDK Java language features in Android.
Fonts using XML file
You can now use fonts as resources as it is a new feature introduced in Android O. There is no need to keep all fonts in assets. You can access these fonts with the help of newly introduced type, font.
Note: You can check more information about how to use fonts here.
There is this new feature of adaptive launcher icon in Android O that supports visual effects and can display a variety of shapes across different device models. For example– you can configure launcher icon circular on one device and square on another device, it’s totally up to you.
Note:You can check more information about adaptive icons from this link.
Android O allows you to let the size of the text expand and contract automatically based on the boundaries of the TextView.
You can set up the TextView auto sizing via code or XML. The two types can be setup like:
- Granularity- By using this, you can set up the minimum and maximum range of the text size.
- Preset Size- By using this, you can auto size the TextView from the list of predefined sizes.
Note: You can check more information about Autosizing TextView from this link.
Say goodbye to casting views after findViewById().
Note: You can check more information about generic findViewById from this link.
Snoozing of Notifications
You can now snooze the notifications and can see later. Developers can also get all the snoozed notifications using- getSnoozedNotifications().
Set the text on the tooltip that will be displayed in a small popup window. The tooltip will be displayed:
- On Long Click, unless is not handled otherwise.
- On hover, after a brief delay since the pointer has stopped moving
Note:You can check more information about how to use setToolTip() from this link.
Progress Dialog is no longer there, it’s deprecated now
Progress Dialog is now deprecated in Android O. It uses a progress indicator such as ProgressBar inline inside of an activity rather than using this modal dialog.
A dialog shows a progress indicator and an optional text message or view. Only a text message or a view can be used at the same time. The progress range is 0 to max and cancelable on the back press.
Notification.Builder() is now deprecated
Now we have to use Notification.Builder (context, channelId). ChannelId is a string value and mandatory for all posted notifications.
Note: You can check more information about channelId from this link.
It’s time to remove BroadCast Receiver from the Manifest
In Android O, they have set the limit on the background executions. You should remove all implicit broadcast that is for intents. If you keep them in place then it will not crash your app but will be of no use when your app will run on Android O.
Autofill will save user’s time to fill the information in forms, like details such as credit card or personal account in their devices. The Autofill Framework manages the communication between the app and autofill service.
Note: You can check more information about how autofill can be used from this link.
Developers can start using Android O by setting up the compileSdkVersion as ‘android-O’, targetSdkVersion as ‘O’ and buildToolsVersion as ‘26.0.0-rc1’.
You must set the support dependency as-
If you want to dive deeper, you can check out this video. For more information on features and APIs, you can read their official documentation. I hope you enjoyed reading about the new features in Android O and are equally excited as I am to see what’s in store for developers.
Thank you for reading.