android o

What’s New in Android O for Developers

Android O has more control over what applications in the background can do as part of an effort to improve interactive performance by improving RAM usage.

Android Nougat prevented apps from receiving three specific implicit broadcasts, such as the new photo broadcast from manifest-declared receivers. Apps targeting O will no longer receive implicit broadcasts to most manifest-declared receivers. There are a few exceptions that will still be allowed, such as BOOT_COMPLETED, LOCALE_CHANGED, et cetera. Explicit broadcasts that target the application package that are registered in the manifest will still be received, like ACTION_MY_PACKAGE_REPLACED. And you can still register to receive implicit broadcasts while you have it active. On apps targeting Android O, background services now only run for a short time after the app no longer has visible activity or a foreground service. startService, or service PendingIntent will throw an IllegalStateException when the app is not in the foreground.

android o

Foreground services that require a persistent notification work as usual. And there’s a new API to start a foreground service directly, startServiceInForeground. Finally, even if your app doesn’t target O, there will be a few changes. First, when your app enters the cached state– that is, with no active Android component– any wake lock it holds will be automatically released. Second, location updates will change. Apps that request background location updates will only get limited updates a few times per hour. Foreground services aren’t impacted. So apps that do navigation or track fitness can continue to get faster updates while they are performing their location-dependent tasks. If another app is using location in the foreground, then your background app can get location updates at the same frequency as that foreground app. We are constantly working to improve user privacy. So even if you don’t target O, you will notice a change with Android ID in Settings.Secure. In O, it will return a different identifier for different apps. In other words, it is now scoped per app, per user. This new value will persist across app reinstalls. But for a simple, standard system to help monetize app, use user-resettable Advertising ID instead, provided by Google Play Services.

Also considering privacy, apps targeting O won’t be able to get access to user accounts using GET_ACCOUNTS permissions alone. Instead apps must rely on the account choosing activity. Account owners can now choose whether the accounts will be visible to other apps, and the account choosing activity will be updated accordingly. Android O adds notification channels to give you those more fine-grained control of notifications and app developers more flexibility to send different types of notifications with less risk of being completely blocked. A notification channel is a named category of notification from a single app.

Users can block a single category, or alter its behavior, such as changing buttons, adding vibration and lights, and altering the lock screen privacy. You can use channels to have different categories of notification. For example, a chat app may show two different chat conversations. End user may be able to apply different settings to them. A long press on Notification [? brings ?] the channel settings. All apps targeting O must implement channels. Otherwise, the notification will not show up. It’s super easy to do. Just create a channel, and then call said channel within the notification builder. There is much more in [? user notifications ?] like ability to snooze, set timeouts to cancel, background colors of notification display. Make sure to check out the details. Filling out forms is a time-consuming and error-prone task. The new autofill framework makes it easy for apps to help their users through this. Android O allows users to select an autofill app, similar to the way the keyboard app is selected. The autofill app is responsible for storing and securing user data, such as addresses, credit card information, user names, and even passwords.


There’s also a new view API that you need to implement in custom views to ensure that metadata is exposed to the autofill framework. Picture in picture is now available for all devices, not just Android TV. All an app has to do is to call enter picture in picture mode method from the resumed or paused state, where the system supports entering picture in picture. Just like multi-window, the activity gets into paused state when in picture in picture mode. So if you have a media app, make sure that the playback continues in paused state as well. SetPictureinPictureArgs allow activity to specify the picture in picture aspect ratio, along with custom remote actions that allow the user to interact with the picture in picture activity directly. Rather than having the app explicitly use the presentation API, regular activities can now be launched on secondary displays. These displays have per display based configuration and resource management.

This means that some part of the configuration, such as screen width DP, screen height DP layout, density DP, will be set according to the display on which the activity currently resides. Fonts are now a fully supported resource type in Android. You can use the getFont method to get a font by its ID. You can also define entire font families in XML, declaring the font style and weight along with the font resource. There is much more in the developer preview than this.

Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *