![](http://habrastorage.org/getpro/habr/avatars/c62/f71/ed6/c62f71ed62715557e8873a4b53ab9d3a.jpg)
Folding smartphones: what about apps?
![](https://habrastorage.org/webt/2c/px/eg/2cpxegjje9jhvrk7e88qn-dgdpi.png)
Announcements of folding smartphones went all week: Samsung and Huawei are already eager to rob us of a large sum, while Oppo and Xiaomi have prototypes for now.
They were discussed vigorously, but mostly it was about hardware and prices. And for any new form factor, software support is also important: you can recall how, with the advent of the iPad, you first had to use “iPhone” applications that looked terrible on a 10-inch screen, and later adapted ones gradually appeared.
Will there be difficulties with existing Android applications on “clamshells”? What to prepare for those users who decide to buy an expensive device? And what needs to be done by the developer so that these users are satisfied? How to test your application if you don’t have a device for $ 2000 at hand?
Under the cut, we described this both from the “user” side and from the “development” one. We could have missed something - so if Android developers add in the comments, we will be happy.
UI optimization
Hurray, thanks to folding beds, a big screen now fits into your pocket! You can not constantly scroll the text in three lines, but see a lot of information at once! It’s convenient how to use everything! So?
Well, let's compare. On the left is how the Twitter app now looks on the screen of a 6-inch smartphone. On the right is how it can look on a newfangled folding thing with a close to square screen, like the Huawei Mate X (we won’t vouch for pixel-by-pixel accuracy, but the essence is this):
![](https://habrastorage.org/webt/ah/al/2p/ahal2p5p5_anzgpqiftcxji5dia.jpeg)
That is, two tweets got on the old screen, and one and a half on the new one. Oops Now you can buy a phone for more than $ 2000 to make it more inconvenient to read Twitter.
Why is that? In the Twitter application, the interface is designed only for a regular telephone screen, where “pin up a photo in full width” will never be too wide. (As a result, under ChromeOS, this application looks like you don’t want to see it.)
It seems that we already went through all this in 2011 with the advent of Android tablets: at first, phone applications looked bad on them, then Fragments were added to Android, developers began to work to make their applications look different on different screens, everything became so good? The problem is that now Android tablets are not in demand, it has become unclear whether it is necessary to invest in their support, and as a result, applications with display on large screens are now very different. Specifically, folding smartphones also have a non-standard aspect ratio.
Theoretically, just the appearance of clamshells could change the situation: a new fashionable category of devices breaks in, and everyone is trying to make their applications look better on them. But in practice, while such smartphones cost from $ 2,000, their market share will be so small that they are unlikely to adapt to them.
This is not the end of the world: say, the same Twitter in the web version looks much better, and in general the web adapts much better to different screen sizes, so browsing should really become more comfortable. In addition, if in the future folding phones will become cheaper, then this may change the layout. But, in general, so far not everything is smooth in the Danish kingdom.
User Conclusion
Do not believe the beautiful pictures from the presentations, where they will select applications that look great on the device - if you want to buy a “clamshell”, first check how important you look.
Conclusion for developers
Whether to invest resources in different options of the interface is more visible to you yourself, based on your situation. But on the occasion of the appearance of "clamshells", try to open your application on the screen even more than a telephone, at least in the emulator and see what happens - maybe you will shudder and want to change the situation.
Transition between screens
Typically, Android developers do not face the fact that their application directly during use is transferred to another screen with a different resolution and aspect ratio. The presentations of folding smartphones show how seamlessly all this will happen: I started watching the video on the folded device, then laid it out and continue from the same place. In practice, will it always be so hassle-free?
From the point of view of the application, at the moment of transition, what happens in Android development is called configuration change. By default, Android in such cases recreates the current application screen, which theoretically could mean the loss of part of the current data.
But, fortunately, this is not the first variety of configuration change that has appeared: for example, a simple screen rotation of a regular smartphone also fits this definition. And since this simple turn could deprive the user of the data just entered for a long time, measures have been taken for a long time to save them. Finally, it all depends on the developers of a particular application (whether they made sure that their application handled the configuration change correctly), but in general the situation is favorable: there was no new big problem, only a kind of the old one that has been successfully managed for a long time.
Conclusion for users.
Probably, the vast majority of popular applications will work out the transition between screens correctly, but in some cases, flaws can occur.
Conclusion for developers
In general, it is simply required that your application correctly execute the configuration change (see, for example, the “Handle configuration changes” page in the official documentation).
But how to verify in practice that the transition between the screens is successful, if you do not have “clamshell” for testing? While there are no virtual clamshells in the Android Studio emulator, Samsung has made a
You create a large tablet in AVD Manager, install a special APK-file from the Samsung website, and a “switch” is added between two options: each uses only part of the tablet screen, corresponding in resolution to one of the Samsung Fold screens. It looks like this (switch on the virtual screen at the bottom right, with numbers 1 and 2):
![](https://habrastorage.org/webt/qg/z_/oe/qgz_oehdwrt5ql-ie6ecnhannwe.png)
Multi window mode
Another feature of the new category is multi-windowing: Samsung directly talks about how great it will be to display three applications on the Fold screen at once. What will happen to this?
At first glance, there is also no revolution: back in Android 7.0, it became possible to display two applications at once, and the transition from two windows to three is not so fundamental. It seems that then all conclusions can be drawn on how this will work, on what we could see for a long time?
But just now, a new nuance has arisen: Google has announced that the multi-window mode has a new “multi-resume” option. Previously, of the simultaneously displayed applications, only one was “fully active” (the one that is “in focus”), and the rest were in the “pause” mode, now several can be equally active at once:
![](https://habrastorage.org/webt/oo/kv/aa/ookvaagyxmmghb2f4pvjn0y2dhi.png)
And what causes this and what changes? Google writes something like the following (we freely translate from polite English into spoken Russian):
“Developers, they’re like you, you don’t read official guides and don’t implement the correct approach to multi-window mode. You think that since it is called a “pause”, you should generally pause everything in the application - a video, for example. But if the user divided the screen between your video player and another application, then the hedgehog is understandable that he wants to continue watching the video. Well, since it’s too difficult for you to follow the right practices, figs with you, we will adjust: now all the applications on the screen can be active at the same time. ”
So far, this is all in test mode (multi-resume will work only in cases where both the application developer has expressed his consent to this and the device manufacturer). But later they are going to make it the norm for everyone, and not only on “folding beds”, but also in a two-window split-screen on ordinary smartphones.
Conclusion for users
So far, everything is in an intermediate state. It seems that at the moment some applications in multi-window mode will not work conveniently (for example, the messenger may not show new messages if it is currently out of focus). But Google is struggling to fix this. You’ll look better in a couple of years.
Conclusion for developers
You can connect to the new multi-resume option by adding the following line to AndroidManifest:
But since the manufacturer’s consent is also required (and it’s not yet clear whether everyone will give it), it’s probably better to study the Google page “Multi-window support” and implement onPause () with it in mind, without stopping everything stopping there.
Minute of advertising. If you were interested in “conclusions for developers” in this text, then the Mobius conference may be of interest to you: from there, mobile developers can make many valuable conclusions on a variety of occasions. It will be held May 22-23 in St. Petersburg, you can learn more on the site .
And if you yourself have valuable conclusions on the urgent issue for mobile developers - now the last days are coming when you can apply for a report !