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.
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.
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...).
Android 12 adds a new effect for lists called "stretch overscroll". Content of scrolling container stretch and bounces back on a drag event.
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.
Applications that target Android 12 cannot start foreground service while running in background (there are few exceptions like obtaining high priority message from FCM).
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.
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.
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.
On devices running Android 12 or higher, when app accesses camera or microphone an icon appears in status bar (upper right corner).
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.
To deliver beautiful UX on devices with rounded corner, new API can be used to query for corner details.
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.
Android 12 provides tools to create informative haptic feedback for UI events or immersive effects for gaming or productivity.