Learn how to add support for Samsung Multi Window and PopUp mode to your android application easily.

How to add support for Samsung Multi Window and PopUp mode to your Android application

With the latest samsung devices and the introduction of Android/Samsung MultiWindow and PopUp mode, you're able to split your screen and use more than 1 app at time. Really useful feature for multitasking.

All modern phones have multi-tasking capabilities, yet some are clearly better than others. Samsung Galaxy S6 multi window is not a new feature, it is actually quite stable and reliable.

But not only is the hardware which makes the difference, but also software. At less this feature for a normal android app, you'll be not able to use those modes automatically, you'll need to give the right permission to your app to access these features.

Features

Samsung multi window allows two type of views (as shown below):

Split screen view

Two apps share the screen without overlapping. You can adjust the size and location of for one app. The other app will take the rest of the screen.

Split screen view

Pop-up view

Two or more apps float on the screen. They can overlap, partially overlap with each other. You can move and re-size them individually without affecting others.

Android popup view

Enable those features

To enable those features we'll need to modify our AndroidManifest.xml file and add the following tags on it :

<!-- This goes inside the first intent-filter tag <intent-filter android:label="@string/launcher_name"> -->
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />

<!-- Finally add the library (if available on the device) and add the meta-data permissions 
     Outside of your <activity> but inside the <application> tag.
-->
<uses-library android:name="com.sec.android.app.multiwindow" android:required="false" />
<meta-data android:name="com.samsung.android.sdk.multiwindow.penwindow.enable" android:value="true" />
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />

Adding those tags, will make that your Manifest look like (focus on the green highlight) :

Android multiwindow popup

The first config-file tag will create a launcher of your app in the menu bar where appears the apps that supports this feature. Remember that if you want that your app appears on the bottom (or top if there's no active split window) while trying to open another app i.e , you'll need to restart your device and then it will appear.

The second config-file tag will contain the permissions and the most important line of this setup. The uses-library tag specifies a shared library that the application must be linked against. This element tells the system to include the library's code in the class loader for the package. As your app probably is NOT only for marshmallow users, we need to set android:required to false in order to provide compatibility for previous versions as KitKat and Lollipop. 

And finally the meta-tags that will allow the use of those features if the library is available.

If android:required is set to true, the PackageManager framework won't let the user install the application unless the library is present on the user's device. Of this way, the Samsung users will be able to resize how they want your app.

Now build your app and test it on your device. Have fun.


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors