-3.1 C
New York
Thursday, January 30, 2025

Modifications to orientation and resizability APIs in Android 16



Modifications to orientation and resizability APIs in Android 16

Posted by Maru Ahues Bouza – Director, Product Administration

With 3+ billion Android gadgets in use globally, the Android ecosystem is extra vibrant than ever. Android cell apps run on a various vary of gadgets, from telephones and foldables to tablets, Chromebooks, automobiles, and most just lately XR. Customers purchase into a complete system ecosystem and count on their apps to work throughout all gadgets. To thrive on this multi-device setting, your apps must adapt seamlessly to completely different display screen sizes and type components.

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

With this in thoughts, Android 16 is eradicating the power for apps to limit orientation and resizability on the platform degree, and shifting to a constant mannequin of adaptive apps that seamlessly modify to completely different display screen sizes and orientations. This modification will scale 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 supply a constantly wonderful person expertise throughout all the 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 gadgets.

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

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

The next manifest attributes and APIs will probably be ignored for apps concentrating 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 are smaller than sw600dp (e.g. most telephones, flippables, outer shows on massive display screen foldables)

Additionally, customers have management. They will 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, concentrating on API degree 36, that had been beforehand letterboxed on massive display screen gadgets will fill the show in panorama orientation on Android 16

Prepare for this alteration, 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 not be a approach to prohibit the facet ratio and orientation to portrait or to panorama.

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

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

Resolving frequent issues

    • Keep away from stretched UI elements: If layouts had been designed and constructed with the belief of telephone screens, then app performance could break for different facet ratios. For instance, if a format was constructed assuming a portrait facet ratio, then UI components 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 have the ability to click on on buttons or different UI components which are offscreen, leading to complicated or damaged habits. Add a most width to elements 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 incessantly in response to how the person prefers to make use of an app, comparable to by rotating, folding, or resizing an app in multi-window or free-form windowing modes. Orientation adjustments and resizing will end in Exercise recreation by default. To make sure a superb person expertise, it’s vital that app state is preserved by way of 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 manner that doesn’t require device-specific customizations. Apps must also be constructed with the belief that window sizes will incessantly change. It’s not obligatory to construct duplicate orientation-specific layouts – as an alternative, guarantee your present UIs can re-layout effectively 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

Should you’re already constructing adaptive layouts and supporting all orientations, you are arrange for fulfillment as your app will probably be ready for every of the system varieties and windowing modes your customers need to use your app in and these adjustments ought to have minimal influence.

We have additionally received 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% progress in pill customers within the 4 months after they optimized their app to be adaptive.

Timeline

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

That will help 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 giant display screen gadgets (smallest display screen 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 giant display screen gadgets (smallest display screen 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 gadgets Developer opt-out allowed
36 (Android 16) Giant display screen gadgets (smallest display screen width >600dp) Sure
37 (Anticipated) Giant display screen gadgets (smallest display screen width >600dp) No

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

Getting ready for Android 16

Seek advice from the Android 16 adjustments web page for all adjustments impacting apps in Android 16, in addition to further sources for updating your apps if you’re 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 varied Android ecosystem. Try the do’s and don’ts for designing and constructing throughout a number of window sizes and type components, as effectively tips on how to check throughout the number of gadgets that your app will probably be utilized in.

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

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles