Thursday, February 13, 2025

Latest Posts

Modifications to orientation and resizability APIs in Android 16



Posted by Maru Ahues Bouza – Director, Product Administration

With 3+ billion Android units in use globally, the Android ecosystem is extra vibrant than ever. Android cell apps run on a various vary of units, from telephones and foldables to tablets, Chromebooks, vehicles, and most not too long ago XR. Customers purchase into a complete gadget ecosystem and count on their apps to work throughout all units. To thrive on this multi-device setting, your apps have to adapt seamlessly to completely different display sizes and type elements.

Many Android apps depend on person interface approaches that work in a single orientation and/or prohibit resizability. Nevertheless, customers need apps to make full use of their massive screens, so Android gadget producers added well-received options that override these app restrictions.

With this in thoughts, Android 16 is eradicating the flexibility for apps to limit orientation and resizability on the platform degree, and shifting to a constant mannequin of adaptive apps that seamlessly alter to completely different display sizes and orientations. This variation will cut back fragmentation with habits that higher meets person expectations, and improves accessibility by respecting the person’s most well-liked orientation. We’re constructing instruments, libraries, and platform APIs that will help you do that to offer a constantly wonderful person expertise throughout the complete Android ecosystem.

What’s altering?

Beginning with Android 16, we’re phasing out manifest attributes and runtime APIs used to limit an app’s orientation and resizability, enabling higher person experiences for a lot of apps throughout units.

These adjustments will initially apply when the app is operating on a big display, the place “massive display” signifies that the smaller dimension of the show is bigger than or equal to 600dp. This consists of:

    • Internal shows of enormous display foldables
    • Tablets, together with desktop windowing
    • Desktop environments, together with Chromebooks

The next manifest attributes and APIs might be ignored for apps focusing on Android 16 (SDK 36) on massive screens:

Manifest attributes/API Ignored values
screenOrientation portrait, reversePortrait, sensorPortrait, userPortrait, panorama, reverseLandscape, sensorLandscape, userLandscape
setRequestedOrientation() portrait, reversePortrait, sensorPortrait, userPortrait, panorama, reverseLandscape, sensorLandscape, userLandscape
resizeableActivity all
minAspectRatio all
maxAspectRatio all

There are some exceptions to those adjustments for controlling orientation, facet ratio, and resizability:

    • As talked about earlier than, these adjustments will not apply for screens which can be smaller than sw600dp (e.g. most telephones, flippables, outer shows on massive display foldables)

Additionally, customers have management. They’ll explicitly opt-in to utilizing the app’s default habits within the facet ratio settings.

Two hands hold a folding phone, showing the Developer News feed in both the folded and unfolded states. The unfolded view shows more news items.

Apps, focusing on API degree 36, that have been beforehand letterboxed on massive display units will fill the show in panorama orientation on Android 16

Prepare for this modification, by making your app adaptive

Apps might want to assist panorama and portrait layouts for window sizes within the full vary of facet ratios that customers can select to make use of apps in, as there’ll now not be a option to prohibit the facet ratio and orientation to portrait or to panorama.

To check in case your app might be impacted by these adjustments, use the Android 16 Beta 1 developer preview with the Pixel Pill and Pixel Fold collection emulators in Android Studio, and both set targetSdkPreview = “Baklava” or use the app compatibility framework by enabling the UNIVERSAL_RESIZABLE_BY_DEFAULT flag.

For current apps that prohibit orientation and facet ratio, these adjustments could lead to issues like overlapping layouts. To unravel these points and meet person expectations, our imaginative and prescient is that apps are constructed to be adaptive, to offer an optimum expertise whether or not somebody is utilizing the app on a cellphone, foldable, pill, Chromebook, XR or in a automotive.

Resolving widespread issues

    • Keep away from stretched UI parts: If layouts have been designed and constructed with the idea of cellphone screens, then app performance could break for different facet ratios. For instance, if a format was constructed assuming a portrait facet ratio, then UI parts that fill the max width of the window will seem stretched in landscape-oriented home windows. If layouts aren’t constructed to scroll, then customers could not be capable to click on on buttons or different UI parts which can be offscreen, leading to complicated or damaged habits. Add a most width to parts to keep away from stretching, and add scrolling to make sure all content material is reachable.
    • Protect state throughout when window measurement adjustments: Eradicating orientation and facet ratio restrictions additionally signifies that the window sizes of apps will change extra ceaselessly in response to how the person prefers to make use of an app, reminiscent of by rotating, folding, or resizing an app in multi-window or free-form windowing modes. Orientation adjustments and resizing will lead to Exercise recreation by default. To make sure a great person expertise, it’s important that app state is preserved by these configuration adjustments in order that customers don’t lose their place within the app when altering posture or altering windowing modes.

To account for various window sizes and facet ratios, use window measurement lessons to drive format habits in a means that doesn’t require device-specific customizations. Apps must also be constructed with the idea that window sizes will ceaselessly change. It’s not essential to construct duplicate orientation-specific layouts – as a substitute, guarantee your current UIs can re-layout properly it doesn’t matter what the window measurement is. In case you have a landscape- or portrait-specific format, these layouts will nonetheless be used.

Optimizing for window sizes by constructing adaptive

For those who’re already constructing adaptive layouts and supporting all orientations, you are arrange for achievement as your app might be ready for every of the gadget sorts and windowing modes your customers wish to use your app in and these adjustments ought to have minimal impression.

We have additionally obtained a variety of testing sources that will help you assure reliability. You’ll be able to automate testing with instruments just like the Espresso testing framework and Jetpack Compose testing APIs.

FlipaClip is a superb instance of why constructing for a number of form-factors issues: they noticed 54% development in pill customers within the 4 months after they optimized their app to be adaptive.

Timeline

We perceive that the adjustments are important for apps which have historically solely supported portrait orientation. UI points like buttons going off display, overlapping content material, or screens with digicam viewfinders may have changes.

That can assist you plan forward and make the mandatory changes, right here’s the deliberate timeline outlining when these adjustments will take impact:

    • Android 16 (2025): Modifications described above would be the baseline expertise for big display units (smallest display width > 600dp) for apps that concentrate on API degree 36, with the choice for builders to opt-out.
    • Android launch in 2026: Modifications described above would be the baseline expertise for big display units (smallest display width >600dp) for apps that concentrate on API degree 37. Builders is not going to have an choice to opt-out.
Goal API degree Relevant units Developer opt-out allowed
36 (Android 16) Giant display units (smallest display width >600dp) Sure
37 (Anticipated) Giant display units (smallest display width >600dp) No

The deadlines for focusing on a selected API degree are app retailer particular. For Google Play, the plan is that focusing on API 36 might be required in August 2026 and focusing on API 37 will be required in August 2027.

Making ready for Android 16

Seek advice from the Android 16 adjustments web page for all adjustments impacting apps in Android 16, in addition to extra sources for updating your apps in case you are impacted. To check your app, obtain the Android 16 Beta 1 developer preview and replace to targetSdkPreview = “Baklava” or use the app compatibility framework to allow particular adjustments.

We’re dedicated to serving to builders embrace this new period of adaptive apps and unlock the complete potential of their apps throughout the various Android ecosystem. Take a look at the do’s and don’ts for designing and constructing throughout a number of window sizes and type elements, as properly how one can check throughout the number of units that your app might be utilized in.

Keep tuned for extra updates and sources as we method the discharge of Android 16!

Latest Posts

Stay in touch

To be updated with all the latest news, offers and special announcements.