How Applications Work in Foldable SmartPhones

By May 17, 2019 August 7th, 2019 Mobile App Development

While the air of uncertainty is still shrouding the foldable mobile phones and their longevity, it is not warding techies and tech enthusiasts from exploring the niche. We too consider foldable mobile phones to be a notch above the conventional smartphones for their larger screen while still fitting in the hand.

It is well known that when you unfold a phone, the display is merged and scaled to the corners of the screen, here are some more facts which you might not have known already.

Screens seem to be continuous and simultaneous

Applications are automatically moved from one screen to another when you swap between the screens. The transition is almost instant and smooth as if sliding through the foam. The app, in transition, receives the configuration change for the new layout. However, for your app to move from one layout to another without any lags and jumps, it should support runtime configuration change.

Sparkout Tech’s finely crafted applications are packed with the right elements to provide a seamless experience in every device including the foldable.

Here is a brief on how you can handle Runtime Configuration

    • Restoring your activity to its previous state is crucial to handle a restart. A combination of onSaveInstanceState()ViewModel objects, and permanent storage would save and restore the UI state across configuration changes.
    • The following onConfigurationChanged() implementation looks into the device’s current orientation.

@Override
publicvoidonConfigurationChanged(ConfigurationnewConfig) {
super.onConfigurationChanged(newConfig);
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show();
} elseif (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show();
}
}

All the apps are on resume – even the ones in the background

Conventionally, when you switch between multiple applications, the only application which occupies your screen and is currently working will be active; applications in the background will be on pause. But in foldable smartphones, all the applications will be functioning – even the ones in the background. It amplifies the multitasking element and completely eliminates clutters and delays.

The following meta-data will manifest the feature in your applications.

<meta-dataandroid:name="android.allow_multiple_resumed_activities"android:value="true"/>

You can view and work on the screen of the desired size

The ability to shorten and extend the screen offers a huge customization option. It is more of a preference and likeability. You can use the narrow screen to make calls and messages, while the widescreen extends the movies and gaming experience. But again, it is a personal choice.

Folding and unfolding the phone triggers a configuration change for the smallest screen size, screen size, and screenLayout.

ActivityOptions provides two new methods supporting multiple displays

<activity

android:name=“.MyActivity”

android:configChanges=“screenSize|smallestScreenSize|screenLayout”

/>

  • Do not call finish() or kill the process in the activity’s onDestroy() for it will cause the app to close when the device is folded or unfolded.

Aspect ratio

  1. 1. Declare the target SDK version

Apps that target Android 8.0 (Oreo) or higher will fill the entire screen.

  1. 2. Declare the resizeableActivity

If the activity is resizable, your Activity will fill the entire screen.

Code Block 2 Set attribute in your manifest’s <activity> or <application> element

android:resizeableActivity=[“true”|“false”]

  1. 3. Declare a max aspect ratio

For Android 7.1 and lower, add a <meta-data> element named android.max_aspect in the <application> element.

Code Block 3 meta-data android.max_aspect

<!– Render on full screen up to screen aspect ratio of 2.4–>

<!– Use a letterbox on screens larger than 2.4–>

<metadata android:name=“android.max_aspect”android:value=“2.4”/>

Before we Conclude

The foldable smartphone closes the inch to the PCs. You can also keep multiple apps open at the same time and work with all of them at the same time, much like computers. You can literally turn it into a tab when u unfold. Read, play, watch movies with these dynamic smartphones. Sparkout Tech has opened its arms and embraces the foldable smartphones by optimizing its applications to thrive in all the environments.

Bottom Line

If you know even a part of mobile phone history, you would recognize how the iconic flip mobile phones were buzzing at a time. It was once the pop culture and made its way even into the movies, which made it even popular. Foldable smartphones have the potential to conquer the market and can become the icon of the age. But we will have to wait for the time to the fleet before we can witness the change.

Leave a Reply