1

AndroidStudio screenshot showing the warning:

enter image description here

Yet what I find here is:

Android 8.0 (API level 26) allows activities to launch in picture-in-picture (PIP) mode.
PIP is a special type of multi-window mode mostly used for video playback. It lets the
user watch a video in a small window pinned to a corner of the screen while navigating
between apps or browsing content on the main screen.

Nowhere can I find where this is now depracated. Am I missing something or is AS in error? I want to be sure I'm not coding down a dead path.

spartygw
  • 3,289
  • 2
  • 27
  • 51

2 Answers2

1

enterPictureInPictureMode() was introduced in API 24 and deprecated in API 26. It has been superseded by enterPictureInPictureMode(PictureInPictureParams), introduced in API 26.

Documentation here: https://developer.android.com/reference/android/app/Activity#enterPictureInPictureMode(android.app.PictureInPictureParams)

Ben P.
  • 52,661
  • 6
  • 95
  • 123
0

@Override public void onUserLeaveHint() {

   // Crear un objeto PictureInPictureParams
   PictureInPictureParams.Builder pictureInPictureParamsBuilder =
           new PictureInPictureParams.Builder();
   pictureInPictureParamsBuilder.setAspectRatio(new Rational(16, 9));
   pictureInPictureParamsBuilder.setSourceRectHint(new Rect(0, 0, 100, 100));
   PictureInPictureParams pictureInPictureParams = pictureInPictureParamsBuilder.build();

   if (isInPictureInPictureMode()) {
       return;
   }
   enterPictureInPictureMode(pictureInPictureParams);

}

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 30 '23 at 05:23