ionic 4 insert mode picture in picture for Android

427 Views Asked by At

i am doing an app for Android and IOS. For IOS works well background geolocation , but for Android, the system kill the process after 5 min. I would like to implement mode pip but i don't find documentation about it.

1

There are 1 best solutions below

0
On BEST ANSWER

What specific plugins are you using ? And show us your AndroidManifest.xml

From : https://developer.android.com/guide/topics/ui/picture-in-picture

An activity can enter PIP mode when the user taps the home or recents button to choose another app. (This is how Google Maps continues to display directions while the user runs another activity at the same time.)

You need to declare this :

<activity android:name="Activity"
    android:supportsPictureInPicture="true"
</activity>

If you want your user entering in pip mode if he user presses the home or recents button, you have to override onUserLeaveHint() method in Activity.java with this:

@Override
public void onUserLeaveHint () {
    if (iWantToBeInPipModeNow()) {
        enterPictureInPictureMode();
    }
}