Adding Samsung multi-window support to Android application Adding Samsung multi-window support to Android application android android

Adding Samsung multi-window support to Android application


This xda-developers forum post contains a step-by-step guide, which I've paraphrased here.

Make sure your manifest contains the following somewhere inside the <application> tag:

<uses-library android:required="false" android:name="com.sec.android.app.multiwindow" /><meta-data android:name="com.sec.android.support.multiwindow" android:value="true" /><meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:resource="@dimen/app_defaultsize_w" /><meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:resource="@dimen/app_defaultsize_h" /><meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:resource="@dimen/app_minimumsize_w" /><meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:resource="@dimen/app_minimumsize_h" />

For the desired activity, add to its <intent-filter> tag:

<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />

Be sure to define the dimensions above in a resource file.

In the comments section of that blog post a user mentions that the minimum size was causing a problem for him and suggested removing com.sec.android.multiwindow.MINIMUM_SIZE_W and com.sec.android.multiwindow.MINIMUM_SIZE_H.

One user pointed out that specifying the dimensions through a dimension resource didn't work for him; he instead hardcoded the value attribute:

<uses-library android:required="false" android:name="com.sec.android.app.multiwindow" /><meta-data android:name="com.sec.android.support.multiwindow" android:value="true" /><meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:value="632.0dip" /><meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" /><meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:value="632.0dip" /><meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:value="598.0dip" />

I'm afraid I can't try myself as I don't have a Galaxy Note.


After testing my application on Galaxy Note 3 I found out two more things:

MINIMUM_SIZE and DEFAULT_SIZE only works on MultiWindow for Samsung tablets, not in smartphones.

Also if you want to enable Multi-Instance in your application add this line to your AndroidManifest:

<meta-data            android:name="com.samsung.android.sdk.multiwindow.multiinstance.enable"            android:value="true" />


Also worth noting is enabling Pen Window (part of the multi-window system) for your app, along side Multi-Window and Multi-Instance as noted here (http://forum.xda-developers.com/showthread.php?t=2499720):

<meta-data android:name="com.samsung.android.sdk.multiwindow.penwindow.enable" android:value="true" />

and add the Launcher code to your activity:

<category android:name="android.intent.category.PENWINDOW_LAUNCHER" />

As a note to the launcher code, the xda post has it listed with a com.samsung prefix, but I couldn't get it to work on my N3 as described there (I used the modified code above). In the Pen Window, you'll have to hit edit and drag your app from the bottom into the Pen Window Launcher screen before you can use it.