Tuesday, June 15, 2021

Android Multi Window Support

Android 7.0 adds support for displaying more than one app at the same time. On handheld devices, two apps can run side-by-side or one-above-the-other in split-screen mode. On TV devices, apps can use picture-in-picture mode to continue video playback while users are interacting with another app.


Handheld devices running Android 7.0 offer split-screen mode. In this mode, the system fills the screen with two apps, showing them either side-by-side or one-above-the-other. The user can drag the dividing line separating the two to make one app larger and the other smaller.


Starting with Android 8.0, apps can put themselves in picture-in-picture mode, allowing them to continue showing content while the user browses or interacts with other apps.


Manufacturers of larger devices can choose to enable freeform mode, in which the user can freely resize each activity. If the manufacturer enables this feature, the device offers freeform mode in addition to split-screen mode.


Multi-window lifecycle


In multi-window mode, only the activity the user has most recently interacted with is active at a given time. This activity is considered topmost, and is the only activity in the RESUMED state. All other visible activities are STARTED but are not RESUMED. However, the system gives these visible-but-not-resumed activities higher priority than activities that are not visible. If the user interacts with one of the visible activities, that activity is resumed, and the previously topmost activity enters the STARTED state.


Note: In multi-window mode, an app might not be in the RESUMED state even though it is visible to the user. An app might need to continue its operation while it is not topmost. For example, a video-playing app in this state should continue showing its video. For this reason, we recommend that activities that play video not pause video playback in response to the ON_PAUSE lifecycle event. Instead, the activity should begin playback in response to ON_START, and pause playback in response to ON_STOP. If you handle the lifecycle events directly instead of using the Lifecycle package, pause video playback in your onStop() handler, and resume playback in onStart().


references:

https://developer.android.com/guide/topics/ui/multi-window


No comments:

Post a Comment