Android N has a new feature - Multi Window Mode. It enables two applications to be active side-by-side (actually one one is active, other one is paused but we can see both simultaneously).
I am looking for an API that I can call to have my application enter multi-window mode. I couldn't find much help in Android N SDK docs. I am trying to have two activities of my app run side by side, but without user having to do manual steps.
MANUALLY ENTERING MUTLI-WINDOW MODE The user can switch into multi-window mode in the following ways:
If the user opens the Overview screen and performs a long press on an activity title, they can drag that activity to a highlighted portion of the screen to put the activity in multi-window mode. If the user performs a long press on the Overview button, the device puts the current activity in multi-window mode, and opens the Overview screen to let the user choose another activity to share the screen.
Window -> Editor Tabs -> Split Vertically Show activity on this post. Show activity on this post. Show activity on this post. Show activity on this post.
On Android 9.0, with gesture controls enabled, you swipe up from the "pill" to the top of the screen. Tap the icon of the app you want on top of the split-screen. That will call up a menu from which you select "Split Screen." Lastly, you select the app you'd like at the bottom of the split-screen.
The SDK for API 24 introduced a new constant to toggle split screen mode from an accessibility service: https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html#GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN
The constant can be passed to following method: https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html#performGlobalAction(int)
Google seems to have missed to document the new constant in the performGlobalAction
method. I still consider this to be an official API since Google did not mark the constant as hidden.
You have to implement an accessibility service in your app and let the user manually enable the service in system settings->Accessibility so it might not be a viable option for all apps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With