Picture-in-Picture implementation is handled at the app level using Android’s PiP APIs. The Calls SDK only adjusts the call UI layout to fit the PiP window - it does not manage the PiP window itself.
How It Works
- Your app enters PiP mode using Android’s
enterPictureInPictureMode()API - You notify the Calls SDK by calling
enablePictureInPictureLayout() - The SDK adjusts the call UI to fit the smaller PiP window (hides controls, optimizes layout)
- When exiting PiP, call
disablePictureInPictureLayout()to restore the full UI
Enable Picture-in-Picture
Enter PiP mode programmatically using theenablePictureInPictureLayout() action:
- Kotlin
- Java
Disable Picture-in-Picture
Exit PiP mode and return to the full-screen call interface:- Kotlin
- Java
Listen for PiP Events
Monitor PiP mode transitions usingLayoutListener to update your UI accordingly:
- Kotlin
- Java
Auto-Enter PiP on Home Press
To automatically enter PiP mode when the user presses the home button or navigates away, overrideonUserLeaveHint() in your Activity:
- Kotlin
- Java
Android Manifest Configuration
Add PiP support to your Activity inAndroidManifest.xml:
PiP mode is only available on Android 8.0 (API level 26) and higher. On older devices, the PiP actions will have no effect.