
Posted by Alex Vanyo, Developer Relations Engineer
With the rise in Android apps getting used on giant display screen type components like foldables and tablets, an increasing number of apps are constructing absolutely adaptive UIs. See Help completely different display screen sizes for finest practices for updating your app for finest practices for updating your app. The underside line is that Format and app habits must be primarily based on gadget configuration and obtainable options, and never the bodily sort of the gadget.
On the identical time, we get this query rather a lot: “Is there a simple solution to inform if a tool is a foldable, pill, or one thing else?”
It might sound that utilizing the bodily sort of gadget gives all the data builders have to create nice experiences. Nonetheless, we will make extra adaptive apps with a greater person expertise by including extra context. For instance:
- Would you like “flip”-style telephones to rely as foldables?
- Do you wish to decide if a tool is a pill, or simply if mobile performance is out there?
- What would rollables rely as? What about ChromeOS units, or different desktop units that may run Android apps?
The commonest purpose app builders wish to know the kind of the gadget is to allow them to decide what sort of structure to indicate. However with the rise of split-screen and multi-window utilization on giant screens, making structure choices primarily based on gadget sort results in incorrect structure choices in sure eventualities on giant display screen units.
As we’ve been updating our personal apps to higher assist extra units, we’ve seen a couple of essential use instances to spotlight additional. We’ll cowl 4 fundamental eventualities:
- Layouts – Show probably the most applicable UI for various units and folding postures
- {Hardware} options – Implement assist for quite a lot of {hardware} options
- Displaying the title of the bodily gadget sort to the person – Personalize end-user going through data for the kind of gadget.
- Metrics monitoring for gadget sort – Perceive how customers are utilizing your app on several types of units
Layouts
Show probably the most applicable UI for various units, show modes, and folding postures.
Use window dimension lessons to information structure choices primarily based in your present windowing state utilizing opinionated breakpoints which can be derived from frequent gadget varieties. Do not limit orientation or resizability; you stop customers from utilizing your software of their desired method.
Observe folding options with Jetpack WindowManager, which gives the set of folding options that intersect your app’s present window. Word that even when your exercise isn’t receiving any folding options, it may nonetheless be working on a tool able to folding – on the outer display screen, on the interior display screen in a small window, or on an exterior show.
Traditionally, a number of distinct layouts had been created for various display screen sizes, typically with a “pill” structure and a “telephone” structure. These two layouts then existed collectively, and each needed to be stored updated because the app modified. Referring to those layouts as “pill” and “telephone” layouts was helpful when the gadget producers by and huge restricted themselves to creating units that match cleanly into these two classes. Customers as we speak have much more alternative as producers are creating units which can be extra bodily assorted, and usable in several methods.
A single gadget might generally have sufficient room to show a “pill”-sized structure, whereas different occasions (for instance, a folded foldable or break up display screen) the gadget might solely have sufficient room to show a “telephone” structure. There are even instances the place a smaller structure is desired comparable to foldable flip telephone cowl shows.
This might be as a result of a foldable that has a smaller outer display screen and a bigger interior display screen, or each time the person enters multi-window mode and adjusts freeform windowing environments. Critically, the kind of app structure shouldn’t be determined by the bodily sort of the gadget; it must be determined by the present dimension of the app’s window, which can or is probably not full display screen on the present gadget show.
On giant display screen units working Android 12L and better, apps that limit the orientation or resizability might be positioned into compatibility mode because the gadget is rotated or folded or the app enters multi-window mode. Compatibility mode letterboxes the app, preserving the app’s specified restrictions, however lacking the chance to show extra, helpful content material to the person.
{Hardware} options
Implement assist for quite a lot of {hardware} options (for instance, if the gadget has a SIM).
Make dynamic, runtime choices primarily based on whether or not a characteristic is out there, as a substitute of assuming {that a} characteristic is or just isn’t obtainable for a sure type of gadget.
In case your app has a characteristic that’s completely required, Google Play respects the required uses-feature declarations in your manifest. Nonetheless, be conscious that any required options scale back the set of units that your app might be put in on, and including new required options prevents updates to beforehand supported units.
There are various {hardware} options which can be current on some Android units, however not current on others. As units proceed to evolve, we’ve seen a number of instances the place user-facing options should not supported, as a result of builders assume {that a} bodily sort of gadget doesn’t assist a selected {hardware} characteristic.
For instance, we’ve seen instances the place biometric authentication isn’t supplied as a login choice on tablets that assist biometric authentication, even when the identical app helps biometric authentication on telephones. Biometric authentication must be an choice for the person if the gadget helps it, not primarily based on the kind of gadget.
One other instance is assuming mobile connectivity is restricted to standard-size telephones. Foldable units may need “pill”-sized screens, however foldables nonetheless have a mobile connection and a telephone quantity. If a tool has the aptitude, the person ought to have the ability to select to make use of the gadget accordingly.
Some {hardware} options are additionally dynamically obtainable. Peripherals is perhaps hooked up and indifferent by the person, and apps ought to gracefully deal with gaining and shedding entry to those options. {Hardware} options just like the digicam and microphone can solely be utilized by one app at a time, so multi-tasking between completely different apps might also lead to shedding entry to {hardware} options.
Displaying bodily gadget sort to the person
Personalize user-facing data by sort of gadget (for instance, “Run in your pill”)
Referring within the UI to the person’s gadget as merely a “gadget” covers all type components and is the best to implement. Nonetheless, differentiating between the a number of units a person might have gives a extra polished expertise and allows you to show the kind of the gadget to the person utilizing heuristics related to your specific use case.
For instance, Google Play at the moment makes use of the next heuristics for figuring out the gadget title to show to the person when putting in an app on a selected gadget. The logic is restricted to this specific use case, and will change as units and type components evolve.

If you’re displaying the kind of the gadget to the person, and wish to differentiate between the bodily sort of the gadget for personalizing the expertise, comparable to to say “obtain in your foldable” or to indicate extra particular gadget imagery, you need to use the obtainable bodily options as heuristics for which sort of gadget the person is utilizing. Nonetheless, these are solely heuristics and will change because the accepted phrases for referring to the units themselves change. As mentioned above, a foldable gadget might or might not assist different {hardware} options, or have a big display screen.
“Foldable” heuristic:
If a tool has a hinge sensor (which might be decided by PackageManager.hasSystemFeature(PackageManager.FEATURE_SENSOR_HINGE_ANGLE)), then the gadget helps folding in some method. Word: Whereas this covers most foldables shifting ahead, it could not cowl some older foldables that don’t expose a hinge sensor. Moreover, the display screen the app is being displayed on might or might not fold, the gadget may need an extra non-folding display screen as nicely, or the display screen might not at the moment be folded, even when it may fold. Units just like the Samsung Flip have a smallest width of lower than 600dp, The interior display screen of large-screen foldables have a smallest width of 600dp or extra.
“Telephone” heuristic:
99.96% of telephones have a built-in display screen with a width smaller than 600dp when in portrait, however that very same display screen dimension might be the results of a freeform/split-screen window on a pill or desktop gadget.
“Desktop” heuristic:
Desktop units, like ChromeOS units, working Android apps, might expose particular options or atmosphere data that apps can use. As an illustration, ChromeOS has the system characteristic “org.chromium.arc” or “org.chromium.arc.device_management” to allow builders to find out whether or not their app is working on ChromeOS. However apps working on tablets – and telephones, if the person so chooses – might also use desktop-class keyboards and mice for enhanced productiveness.
Metrics monitoring for gadget sort
Perceive how customers are utilizing your app on several types of units.
Use the heuristics and options mentioned above as inputs to your analytics, whereas protecting in thoughts that bodily gadget sort doesn’t give the entire story for a way customers are utilizing your app on that gadget.
Even when the person is utilizing a tool that may bodily fold, they could be utilizing the app in a number of configurations. Customers would possibly use an app kind of on the interior display screen in comparison with the outer display screen, they usually would possibly multi-task with different apps on the interior display screen. For units that assist exterior shows, the app won’t be working on both of a foldable’s built-in bodily shows.
Different data that may even be related:
- Are there exterior peripherals getting used to work together with the app, like keyboards, mice, trackpads, or styluses?
- Does the gadget have a built-in touchscreen?
- Is the app being utilized in a free-form windowing atmosphere?
Conclusion
Do not make assumptions about what a selected bodily gadget implies on your app. “Is the gadget foldable?” is an effective place to begin, but it surely shouldn’t be the one query you ask. Extra items of data will give a extra exact and extra related reply to your use case at hand, and every use case has completely different issues that you must make to construct versatile, adaptive apps.