In Android, I have developed two Apps. I want to launch both apps in split screen mode programmatically with one launcher. How do I do that?
-
1It's possible for sure i can make app Pair's in my `Samsung s8+` but i think it's more dependent on whether the device support's it or not . Samsung does. – Anmol Nov 22 '19 at 05:44
-
@Anmol so how do we do it, do u know? – M. Usman Khan Nov 22 '19 at 11:38
2 Answers
I found the answer.
You can use Accessibility API for such feature. It doesn't require any permissions.
android.accessibilityservice.AccessibilityService
has following apis:
service.performGlobalAction(GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN)
which you can use to initiate split screen mode.
public List getWindows () to check wether split screen mode is on. Look for a window with AccessibilityWindowInfo.TYPE_SPLIT_SCREEN_DIVIDER
You also will need to play with intent flags when launching activities.
val options = ActivityOptionsCompat.makeBasic().toBundle()?.apply {
putInt(
ActivityOptionsFlags.KEY_LAUNCH_WINDOWING_MODE,
ActivityOptionsFlags.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY
)
putInt(
ActivityOptionsFlags.KEY_SPLIT_SCREEN_CREATE_MODE,
ActivityOptionsFlags.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT
)
}
startActivities(listOf(intentBottom, intentTop).toTypedArray(), options)
Using this accessibility apis and intent flags you can achieve your goal. Consult this repo by stavangr for detailed implementation.
https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html

- 3,689
- 1
- 59
- 69
I did search about this long time back but never found any content to launch multiple application using single launcher.Best case i got is in my Samsung device(after s8 series) which support's application pairing(manual by user doc)
What i believe is that Samsung
are allowing it as they must have supported it for there custom Android OS.Just like they have there own custom context Menu code and many other tweaks.

- 8,110
- 9
- 38
- 63