Where does android.max_aspect meta make difference?

Alex Cohn picture Alex Cohn · Apr 3, 2017 · Viewed 9.1k times · Source

A recent blog explains that we must use

<meta-data android:name="android.max_aspect" android:value="2.1" />

in <application> element of AndroidManifest.xml for optimal display on super widescreen devices, e.g. Samsung Galaxy S8.

To test this, I installed my app (no max_aspect, no resizeableActivity flags; targetSdkVersion=22, compileSdkVersion=24) on an Android 7.1.1. emulator with custom 2960x1440 resolution. All activities, including immersive, fill the screen with no margins as shown in the blog post.

I added explicit

<meta-data android:name="android.max_aspect" android:value="1.5" />

and this also had no effect on the emulator.

So, the question: is this meta flag only checked on the real devices, or there is some configuration that I missed for my emulator?

Update: I tried to reach Neto Marin, the author of the cited blog post. I found a proud tweet ] about his contribution to the global Android Dev community, but could not get an answer from him.

Answer

yaroslav picture yaroslav · Apr 21, 2017

The android.max_aspect only makes difference if your android:resizeableActivity is not true. If your app's target API is 24 or higher android:resizeableActivity is set as true.

Note: You do not need to set a maximum aspect ratio if an activity's android:resizeableActivity attribute is set to true. If your app targets API level 24 or higher, this attribute defaults to true. For more information, see Configuring your app for multi-window mode.

Please refer to the documentation.