• Don Peter

What's new for developers in Android 12

Android released its OS version 12 developer preview back in February and is currently in beta 3. The expected date of stable release is in August or September.


Let us take a look at the new capabilities and features that developer can leverage.


Material UI gets an upgrade - Material You

Material You helps developers make design personal for app users. App users can tailor UI and design elements like color to their choice. This revolutionizes the entire concept of app design. Irrespective of the type of device, users will be able to interact and use apps in a familiar User Interface.


Representational image for Material You design.
"Material You" Image Copyright: material.io

Google is yet to open up the APIs for developers. Hence the actual implementation and backward compatibility details are not yet verified.


New API for In-App searching

In Android 12, A document based NoSQL implementation has been introduced. Developers are provided with AppSearch API to store, index, search, share data.

Pictorial depiction of how local storage and platform storage works in appsearch
Basic structure of LocalStorage and PlatformStorage in AppSearch

  • AppSearch comes bundled as part of androidx jetpack library which makes it backward compatible.

  • AppSearch comes with LocalStorage and PlatformStorage support.

  • LocalStorage is an in-app NoSQL implementation.

  • PlatformStorage is a centralized NoSQL implementation that can be used to share data across apps.

  • LocalStorage supports Android 4 and above.

  • PlatformStorage supports Android 12 and future versions.


Privacy Indicator API in WindowInsets

OS will display privacy indicators in status bar of the device. The indicators are shown whenever the device camera or microphone is active. Developers can make use of getPrivacyIndicatorBounds API in WindowInsets to adjust the app interface accordingly so as not to overlap with privacy indicators.


Foreground permission for CDM paired apps

A new foreground permission is added to enable CDM or Companion Device Pairing apps to start foreground services. The name of the permission is REQUEST_COMPANION_START_FOREGROUND_SERVICES_FROM_BACKGROUND.


Game Mode API

Game developers can adjust game play settings based on the value from game mode API. Game Mode API is available in GameManager. It has the following game modes.


UNSUPPORTED mode

The game does not support Game Mode API.


STANDARD mode

The user has not yet selected any game modes. The game settings may remain as it is.


PERFORMANCE mode

User has selected performance mode. Game may adjust its settings to provide lowest latency frame rates even though the battery life may be affected.


BATTERY mode

User has opted for better battery life mode. Game need to adjust its settings to provide longest battery life possible during game play.


Conclusion

One of the impactful feature added is NoSQL based AppSearch. This gives developers the ability to implement efficient search functionality.


Why don't you give it a try?