Implementing Picture In Picture Mode In Android

Implement Picture In Picture mode to allow users to watch videos even while they use other apps. See how a real-world app uses PiP, then learn how to add awesome media playback controls to PiP mode for ease of use! By Filip Babić.

Leave a rating/review
Save for later
Comments
Share

Learning path

This is part of the Android UI & UX: Beyond the Basics learning path. View path.

Who is this for?

Intermediate and advanced Android developers looking to implement Picture In Picture (PiP) mode to provide cool ways for users to keep using their apps while working on other things with their phone.

You should be familiar with Android Studio and Kotlin. Knowledge about using advanced code structures to build different layers in your apps and communicate between them is welcomed.

This course covers a feature from the raywenderlich.com app! Check out the open-source repo here.

Covered concepts

  • Android Screen Resizing
  • Multi-tasking Android apps
  • Picture-In-Picture mode in Android
  • Picture-In-Picture Parameters
  • Picture-In-Picture Lifecycle
  • Configuration Changes
  • BroadcastReceivers
  • MediaPlayer
  • MediaPlayer Actions

Part 1: Implement Picture In Picture Mode

01
Toggle description

Picture In Picture allows users to control an app while they're doing something else! Learn the basics about PIP mode and how it changes the way users can interact with your apps.

Toggle description

Check out the Emitron app, then set up the sample project with Firebase and build configuration.

Learn how to enable PiP mode for Activities through the Android Manifest, and how to enter the PiP mode & attach it to the Activity lifecycle.

Toggle description

Extend your PiP mode functionality to your Fragment, and learn how to expose it through a BroadcastReceiver.

Toggle description

Build the functions of one of the core classes that will let you handle the PiP mode and communicate its state.

Toggle description

Add actions to the PiP container to display different media controls and prepare their actions.

Toggle description

Learn how to process media control by observing the PipAction value from the BroadcastReceiver, allowing the user to use the PiP mode completely.

Up next

Android & Kotlin
Supporting Dark Theme
Android 10 introduced a system Dark theme setting, and modern apps should both support the system setting as well as let users override to their preferred theme. See how to add DayNight themes into your app on Android 10 and earlier versions of Android, and then let your users decide whether to follow the system setting. You'll also learn how to go to a dark theme in battery saver mode.

Instructors

Contributors

Filip Babić

Instructor

Adriana Kutenko

Illustrator

Over 300 content creators. Join our team.