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.
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.
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.
Say goodbye to casting views after findViewById().
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
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.
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.
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-