Search code examples
androidandroid-windowmanagersamsung-mobile-sdkmulti-windowandroid-window

Disable multi window feature programmatically


I am trying to disable multi window feature of android. I have read the android documentation and know that resizeableActivity would only work for android N (API level 24) but I want to disable it on lower level android APIs. As Samsung devices have multi window feature on its all device (approx). So I have to disable it.


Solution

  • You cannot do that in runtime. Your application either supports multi window mode, or it doesn't. Parameters, that are given in AndroidManifest.xml cannot be changed during runtime.

    From the documentation of android:resizeableActivity:

    If this attribute is set to true, the activity can be launched in split-screen and freeform modes. If the attribute is set to false, the activity does not support multi-window mode. If this value is false, and the user attempts to launch the activity in multi-window mode, the activity takes over the full screen.

    For specifically Samsung devices you can try putting this in manifest file:

    <meta-data android:name="com.sec.android.support.multiwindow" android:value="false" />
    <meta-data android:name="com.samsung.android.sdk.multiwindow.multiinstance.enable"
                android:value="false" />
    <meta-data android:name="com.samsung.android.sdk.multiwindow.penwindow.enable" 
                android:value="false" />