12. Oct 2021Android

Android 12 - What's new for developers?

At the start of October 21, official release of Android 12 was pushed to AOSP. What news it brings for developers? There are the most interesting changes for us, organised into multiple logical units.

Peter ŠulyAndroid developer

User interface

Material You

New design guidelines called Material You are introduced with new version of Android system to build more personalized applications. Support for Jetpack Compose is coming soon but you can try an alpha of material components library with components compatible with Material You.

Redesigned Widgets and Notifications

Applications widgets has come with new, fresh redesign to make the more useful and visually appealing. Android 12 widgets have rounded corners, widget's background is automatically cropped. New support for stateful behavior using the CheckBox, Switch and RadioButton has been added.

Also notifications have refreshed design to look more modern. Previously, custom notifications were able to use entire notification space with custom layouts. Now, standard templates ensures that custom notification have the same decoration as other notifications (notification's icon, app name...).

Redesigned widget

Stretch overscroll

Android 12 adds a new effect for lists called "stretch overscroll". Content of scrolling container stretch and bounces back on a drag event.

Splash screens

System introduced new SplashScreen API. Many applications have implemented custom splash screen via Activity or using windowsBackground style. For Android 12, you should migrate to SplashScreen API and ensure that everything is displayed correctly. Without migration, system can inject default splashscreen to your app resulting in 2 consecutive splashscreens.

Performance

Foreground services optimisations

Applications that target Android 12 cannot start foreground service while running in background (there are few exceptions like obtaining high priority message from FCM).

Performance class

Applications can check a device's performance class to see a set of device capabilities. Each Android device should declare performance class that it supports. Developer can check device's capabilities at runtime and provide extra experience for more powerful devices.

Privacy

Privacy dashboard

In system settings a Privacy Dashboard screen appeared. User can access information about when apps access location, camera or microphone. Android Developers should provide a rationale for users, so they can understand why these information is needed.

Approximate location

Users now can grant just approximate location even if application requested precise location. If application requests only coarse location but not fine location then this change is not affecting it. When app needs access to fine location, it must also request coarse location permission in single runtime request. Permission dialog like this is shown when app request both fine and coarse location and targets Android 12 and higher.

Approximate location

Microphone and Camera indicators

On devices running Android 12 or higher, when app accesses camera or microphone an icon appears in status bar (upper right corner).

Mic and camera indicator

User experience tools

Rich content insertion

Developer can attach an interface called OnReceiveContentListener to UI component and get a callback when user inserted content pasted from clipboard or by drag and drop. This API is also available in AndroidX beta for backward compatibility with previous Android versions.

Rounded screens support

To deliver beautiful UX on devices with rounded corner, new API can be used to query for corner details.

Blurs

With new system, developer gains control over graphical effect applied on Views e.g. RenderEffect API. This API provides possibility to create blurry transparent background on Views, apply color filters on Views and more.

Enhanced haptics

Android 12 provides tools to create informative haptic feedback for UI events or immersive effects for gaming or productivity.

How to get apps ready for Android 12?

  • privacy dashboard - check this dashboard in system settings to check access to microphone, location or other sensitive data and reasoning to users
  • microphone and camera indicator - check if indicator doesn't affect your UI
  • clipboard read notification - watch for toast if your app reads data from clipboard unexpectedly and remove this accesses
  • stretch overscroll - ensure that content is displayed as expected with stretch overscroll effect
  • app splash screen - try to launch your app (cold start, hot start, deep link...) and check if splash screen looks like expected and if it doesn't show twice
Peter ŠulyAndroid developer