paint-brush
How To Develop Apps For Foldable Android Devices by@surender
166 reads

How To Develop Apps For Foldable Android Devices

by Surender Vikram SinghOctober 14th, 2019
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Samsung has unveiled it’s highly anticipated Galaxy Fold device and Huawei Mate X. The device is an active-matrix light-emitting diode (AMOLED) screen that allows a higher definition display. When unfolded it reveals an 8 inch OLED tablet screen. Google announced its support for foldable screens before Samsung announced its foldable device. The foldable devices will certainly require developers to develop apps which offer multiple screen sizes and configurations. Android Pie offered the support of multi-resume functionality but it was up to the app developers to opt in.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - How To Develop Apps For Foldable Android Devices
Surender Vikram Singh HackerNoon profile picture
    Have you ever considered carrying your tablet in your pocket? Sounds pretty uncomfortable, Right? Well, now you can.On the off chance that you have been living under the stone and simply found out about it at this moment, then you need to check out this video from Samsung keynote –
    But before Samsung announced anything about its foldable device, Google announced its support for foldable screens.

    Google’s representative Dave Burke described the foldable experience as “Screen Continuity” where the application experience transfer between bigger and smaller screens seamlessly.

    Samsung announces Samsung Galaxy Fold followed by Huawei Mate X

    Samsung has unveiled it’s highly anticipated Galaxy Fold device. Normally, it’s a 4.6-inch screen which can easily fit in your pocket but it unfolds like a book into a 7.3-inch display.
    The screen of the device is made from a composite polymer rather than the traditional glass screens.According to Samsung, it is an active-matrix light-emitting diode (AMOLED) screen that allows a higher definition display.The device is perfect for those who like to multitask as you can open up to 3 active apps simultaneously.The device also comes with a software system called app continuity which allows users to continue to their task while switching between the screens.Huawei was not far behind to showcase its foldable offering by the name of Mate X.
    It’s looking even more promising as it features a 6.6-inch screen compared to Samsung’s 4.6 inches and when unfolded it reveals an 8 inch OLED tablet screen.We can expect many more foldable devices coming this year from different OEM manufacturers and it would be great to see the implementation process of the foldable screen.

    How to Develop Apps For Foldable Phones?

    The foldable devices will certainly require developers to develop apps which offer multiple screen sizes and configurations. The foldable devices will pose some real challenges for developers when it comes to screen sizes and UX of the application.So to start the development of apps for Foldable devices, you need to first look into the design guide as the very first step.

    App continuity

    Whenever you are folding or unfolding your device, it triggers configuration changes:
    1. smallestScreenSize
    2. screenSize
    3. screenLayout
    Apps that do not support multi-window can resize itself when a device gets folded or unfolded. However, when any configuration change occurs, the default case destroys the whole activity and then recreates it.

    So it becomes important for developers to store the previous state of the application. For this developers can use onSaveInstanceState() and ViewModel object.

    Before the activity is destroyed, you can save its state using onSaveInstanceState() and restore it using onCreate() or onRestoreInstanceState().

    Multi-window

    As you all may know, there are two types of multi-window –
    1. Split view
    2. Freeform window
    In normal devices, the split view can hold two apps at the same time. Whereas, Samsung Galaxy Fold supports 3 split view.The foldable devices also enhance the functionality of the freeform window. Thus it becomes important for developers to utilize multi-window to make the best use of the foldable screen.

    Multi-resume

    In the earlier versions of Android, multi-window support only one app active at a time. The other app will be paused when it not active.Android Pie offered the support of multi-resume functionality but it was up to the app developers and OEM’s (Original Equipment Manufacturer) whether to opt in or not.So we can expect Android Q will offer multi-resume as a mandatory behavior.To make you app multi-resume, you have to set the manifest flag so that it can keep the app in the resumed state.
    <application>
     <meta-data
       android:name=”android.allow_multiple_resumed_activities”
       android:value=”true” />
     <activity … />
    </application>

    Optimized layouts

    As the app will be running on both the displays so it would be better to add a separate resource folder to show more rich content. Here is a link for better understanding – 

    Testing your app in a foldable device

    You can easily test your app in a foldable environment by running a foldable emulator provided by Samsung.
  1. Download the emulator from Samsung developers official site
  2. Install the emulator
  3. $ adb install FoldableEmulator.apk
    Grant required permissions to run the application
    PC: ~$ adb shell
    AVD: /$ pm grant com.samsung.android.foldable.emulator android.permission.WRITE_SECURE_SETTINGS
    AVD: /$ pm grant com.samsung.android.foldable.emulator android.permission.SYSTEM_ALERT_WINDOW
    You can also use Android Studio as an alternative to test your application for the foldable device by testing it on appropriate screen sizes.

    Closing comments

    So what is your take on the new foldable devices? Is this the new future of Android devices or it will just fade with time.We will love to hear your thoughts in the comment section.
바카라사이트 바카라사이트 온라인바카라