Android 12 developer preview: Everything developers need to know

Android 12 developer preview: Everything developers need to know

Android 12 logo on Google Pixel 3 2
Credit: Jimmy Westenberg / Android Authority

Wow, is it that time of year already? It seems no time at all since Android 11 landed and yet here we are with the first developer preview of Android 12! As always, we’ll be sharing all the changes devs need to know about in this post.

Highlights include compatible media transposing and new copy-paste features. Of course, Google has lots more changes in store for us with future releases. But this is an early sign of things to come and there’s already some interesting stuff to keep us busy!

For the full scoop, check out the post at Android Developers Blog. Here, I’ll attempt to share the cliff-notes version, and draw your attention to anything that needs your urgent attention.

We’ll be updating this page as future previews roll out, so you’ll be able to find everything you need in this one spot as you prep your app for the future of the platform.

See also: Android 12 features: Everything confirmed and rumored so far

Security

Google is always keen to put emphasis on security and Android 12 is no different. The focus is on increasing use control and transparency. These changes have the potential to impact the way apps behave, so this is important for developers to keep in mind.

Cookie changes in WebView: Google recently made changes to Chrome that change the way cookies are handled. These changes will now be reflected in the Android WebView. The SameSite attribute will dictate whether cookie requests are limited to just that site. Cookies without that attribute will be treated as SameSite=Lax.

Restricted Netlink Mac: Netlink MAC is restricted in Android 12 regardless of targetSDK.

Safer exporting of components: The default handling of andoird:exported attribute has been altered to be more specific. Now components that declare intent filters need to explicitly declare android:exported as well.

PendingIntents to change: PendingIntents will be more secure in Android 12 and must declare a mutability flag.

User-facing changes

A few new changes to Android 12 have potential to improve the user experience.

HEVC transcoding: HEVC hardware encoders are increasingly common and provide improved quality and compression versus older codecs. While most apps should support HEVC, Android 12 now offers built in transcoding to AVC format. A one minute video filmed at 1080p, 30fps HEVC will take roughly 9 seconds to transcode on a Pixel 4. More here.

This should result in a more seamless experience for users and less work for developers. Premiere Pro, take note!

See also: Android 12 developer preview hands-on: Lots of little changes

Platform support for AVIF image format: Likewise, AVIF image support can offer better images and compression for still pictures. Android 12 brings native support for the AV1 format.

Foreground service optimizations: Foreground services are useful for running a number of tasks. Android 12 will block background services from moving into the foreground unless they target the new platform. The new expedited job in JobScheduler will benefit from elevated process priority and network access. It will run immediately even in Battery Saver and Doze modes.

Rich content from clipboard: A new unified API makes it simpler for devs to accept rich content copied from the clipboard, inserted by the keyboard, or dragged from other apps. This should be an effortless way for developers to create new use-cases for their users.

Audio-coupled haptic feedback: Android 12 brings audio-coupled haptic feedback. Strength and frequency of vibration are dictated by audio. This should offer instant improvements to the user experience in games but has other applications, too. An example given by Google is to identify callers from any app based on custom ringtones. Use HapticGenerator#isAvailable() to check whether the device supports haptic feedback.

Navigation

Gestures on by default: Gestures will now be enabled by default in full-screen/immersive apps such as video viewers and eReaders. However, the feature will remain off by default when gaming.

New notifications: Notifications are getting a minor visual overhaul with new transitions and animations. Devs will be able to decorate notifications with more custom content. Get more info here. Devs are also asked to ensure that not to use “trampolines” to ensure rapid launching of apps from notification taps – these will be blocked in apps targeting Android 12 but toasts will be used to make trampolines visible in all cases.

Compatibility

Google says it has taken effort to ensure compatibility with older apps. As such, most user-affecting changes will be on an opt-in basis. Usefully, developers testing their apps on Android 12 will also be able to test compatibility by toggling certain changes on and off.

To get started, you can either flash Android 12 to a Pixel device, or use the system image via the Android Emulator in Android Studio.

Be sure to check back here as we update this post to reflect future previews. In the meantime, let us know what you think about these changes and how they affect your own app projects in the comments below!


For more developer news, features, and tutorials from Android Authority, don’t miss signing up for the monthly newsletter below!

Stay up to date on all things Android Development

Join our developer crew to get a monthly developers newsletter curated by in-house experts!

By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.


source https://www.androidauthority.com/android-12-preview-for-devs-1203675/
Previous Post
Next Post

post written by:

0 Comments: