Skip to content

Commit

Permalink
Allow PIP mode for API level 26 (Android O) or above
Browse files Browse the repository at this point in the history
- enterPictureInPictureMode() causes crash on API level 24.

Signed-off-by: Arka Prava Basu <arkaprava94@gmail.com>
  • Loading branch information
archie94 committed Aug 16, 2018
1 parent 9ff8b02 commit 52e6f70
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/java/org/havenapp/main/MonitorActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.havenapp.main;

import android.Manifest;
import android.app.PictureInPictureParams;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
Expand Down Expand Up @@ -312,8 +313,8 @@ private void initMonitor() {
@Override
public void onUserLeaveHint () {
if (mIsMonitoring) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
enterPictureInPictureMode();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
enterPictureInPictureMode(new PictureInPictureParams.Builder().build());
}
}
}
Expand All @@ -324,8 +325,8 @@ public void onUserLeaveHint () {
public void onBackPressed() {

if (mIsMonitoring) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
enterPictureInPictureMode();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
enterPictureInPictureMode(new PictureInPictureParams.Builder().build());
}
else
{
Expand Down

0 comments on commit 52e6f70

Please sign in to comment.