26 May What’s New in Android O From a Developer’s Perspective
During Google I/O 2017 experts announced the new features added in Android O. We will gather here the most important novelties in order to understand the new changes that you need to make to your apps for the new release. If you want to migrate your app to Android O you can follow the detailed guide provided by Google. There are two stages you need to complete. First of all you have to check if your app is compatible with the new version without using new APIs and without modifying the value for targetSdkVersion. After you are sure that your app functions as expected you are ready to change targetSdkVersion to “O” and to start trying the new features. We will add two observations here. It is mandatory to use Android Studio 3.0 Canary for the second part and you won’t be able to publish your app with the same configuration you built for testing. You just need to wait until the final release of Android O and to modify it accordingly.
What’s New In Android O
Now let’s discover the new features of Android O that will be available in the Q3 of this year. We will make a list with the most important ones but for further documentation you should read Android O Features and APIs.
A new design for notifications comes to improve user experience. Let’s see the main changes that will affect the appearance of these messages:
Notification channels will be seen like notification categories. You can create your own notification channel for each type of notification. When a user changes one of the following attributes by going to Settings or long pressing a notification, the modification applies to the notification channel.
- Show on lockscreen
- Override do not disturb
You can read all the details related to Notification Channels on the official page.
Notification Badges also named Notification Dots are little images that show a notification related to an app which appear on app launcher icons. This way, users will understand that the specific app sent them a notification that wasn’t opened. For more information about this feature you can check Notification Badges.
In a busy moment when you receive a notification you understand that it is important, you quickly scan it and you close it, forgetting all about it. Google wants to prevent that and users can now snooze notifications to reappear after a while with the same level of importance.
In case you want to limit the period when the notification is visible you are able to use just one method for setting a timeout for it: Notification.Builder.setTimeout(). That’s easy, right?
Using onNotificationRemoved() method from the NotificationListenerService class you will be able to check if a notification was dismissed by the user or it was removed by the app.
A new aspect for notifications will be provided by the possibility of setting different background colors for each message according to its importance. You can use two methods for this purpose, Notification.Builder.setColor() for setting the color and Notification.Builder.setColorized() for enabling the use of color for a notification.
For showing more text in the extended form of notification, developers have to use the MessagingStyle class.
Adaptive Launcher Icons
Adaptive Launcher Icons are created for impressing users because they are able to change their shape according to each device. This type of icons can be shown in shortcuts, Settings and overview screens. To create them you need to design two layers, a background and a foreground. For an entire tutorial on how to obtain such creatives you need to go to Adaptive Icons. In Android Studio 3.0 is easier to create adaptive icons with Image Asset Studio, a tool specially introduced for generating app icons.
Autofill Feature API
Autofill Framework is very useful in case you have a specific section inside your app where users need to complete a form to login or to access a credit card account in order to save time and to avoid input errors. For more information on how to implement this feature you can see Autofill Framework.
Multi – Window Mode: Picture In Picture
A new feature is borrowed from Android TV and it is called picture – in – picture (PIP) mode where more than one window are visible on the screen. To make sure that activities of your app launch in PIP mode you should go to AndroidManifest.xml and to set android:supportsPictureInPicture to true. Be careful, because it is very tricky to pause the content of each window but it is all explained in Multi – Window Lifecycle. Along with a new object called android.app.PictureInPictureArgs which should be passed to PIP methods described in Adding Picture – In – Picture, available for all Android devices there are many changes you should study before implementing this API.
Goodbye To Missing Emoji Characters
Android O introduces the EmojiCompat support library for avoiding the display of missing Emoji characters. The best part is that it works also for devices running Android 4.4 and higher. You can read all about it in Emoji Compatibility.
With the new Android O you will be able to declare a category for your app by going to AndroidManifest.xml, to <application> tag and by setting a category like Data Usage, Battery Usage or Storage Usage for the android:appCategory attribute.
Background Execution Limits
For a better user experience, Android O sets some limitations for saving devices’ resources while different services run in the background in two ways, Background Service Limitations and Broadcast Limitations. As a default feature these restrictions are set for apps that target Android O, but users can enable them from Settings also for apps created for older versions. We recommend developers to read the details of Background Execution Limits and about the JobScheduler Improvements.
After we highlighted the most important features and modifications that will be available with the new release of Android O we must tell you that this new version also comes with a few system and API behavior changes. After you read Android O Behavior Changes you can be sure that you are ready to welcome Android O. By the way, what desserts start with “O”?