Monday, May 5, 2014

How to enable MultiWindow support for Android Apps on Samsung devices

Some Samsung devices such as the Note range of handsets can display two apps at the same time in two windows. Samsung calls this two window feature as MultiWindow and supported apps are activated from Samsung's Traybar, a vertical or horizontal strip launcher on the sides of the screen. Tweaking your Android app so that it can run in MultiWindow mode is very easy - just add some meta data tags in the AndroidManifest.xml file as shown in the example below. Then recompile the app.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dom925.trainsity.kualalumpur"
android:installLocation="auto"
android:versionCode="3"
android:versionName="1.0.2" >
<uses-permission android:name="android.permission.INTERNET" />"
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
 
<application
android:name="com.dom925.trainsity.kualalumpur.App"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.dom925.trainsity.kualalumpur.MapListActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<!-- add this category tag here -->
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
</intent-filter>
</activity>
<!-- some stuff deleted here for clarity -->
<!-- add the following meta-data tags here -->
<meta-data 
android:name="com.samsung.android.sdk.multiwindow.enable" 
android:value="true" />
<meta-data 
android:name="android.intent.category.MULTIWINDOW_LAUNCHER" 
android:value="true" />
<meta-data 
android:name="com.sec.android.intent.category.MULTIWINDOW_LAUNCHER" 
android:value="true" />"
</application>
 
</manifest>
An app that supports MultiWindow will be visible in the Traybar launcher. Simply drag out the app from the Traybar launcher. The screenshot below shows a Note device running a Chrome browser and a metro app in MultiWindow mode.

2 comments:

  1. Hi, all seems pretty clear about the Manifests. I need to import some Samsung library in order to Android Studio recognize this changes ???

    Thanks !!!

    ReplyDelete
  2. You don't need to import any Samsung library

    ReplyDelete