Programmatically enter multi-window mode in Android N

Android N has a new feature - Multi Window mode. It allows two applications to be active side by side (in fact, one of them is active, the other is suspended, but we can see both at the same time).

I'm looking for an API that I can call to get the application into multi-window mode. I could not find much help in the Android N SDK docs. I try to ensure that two actions of my application are performed side by side, but without the need to perform manual steps.

EXITING MUTLI-WINDOW MODE The user can switch to multi-window mode in the following ways:

If the user opens the "Overview" screen and performs a long press on the activity title, they can drag this activity to the highlighted part of the screen to enable the operation in multi-window mode. If the user presses the Browse button for a long time, the device places the current activity in multi-window mode and opens the Browse screen so that the user can select another activity for screen sharing.

+5
source share
3 answers

A new constant has been introduced in the SDK for API 24 for switching the split screen mode from the accessibility service: https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html#GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN

The constant can be passed to the following method: https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html#performGlobalAction(int)

Google seems to have skipped documenting the new constant in the performGlobalAction method. I still consider this an official API, since Google did not mark the constant as hidden.

You must implement the availability service in your application and allow the user to manually enable the service in the system settings β†’ Availability so that it is not viable for all applications.

+8
source

With Android N, this is not supported.

The only way to enter multi-window mode is if the user manually starts it.

+2
source

I don’t think that api for what you want to do, you can try to make you two fragments on each side of the screen. With a black stripe in the middle, make each fragment size in accordance with the "X" position on the panel. :)

0
source

Source: https://habr.com/ru/post/1246928/


All Articles