javaandroidandroid-picture-in-picture

On click of app icon full screen the picture in picture content


I am using jitsi-android-sdk in which when I go click home screen it takes me to the picture in picture mode and when I click on the app takes me back to the first form page. How should full screen the picture in picture mode when I click on the app?

what should I put in onResume() so I can full-screen picture in picture on click of the app.

For example, When we are using Netflix and watching a movie on mobile when we press the home button it enters the picture in picture mode and when we click on the app icon it fullscreen the picture in picture mode (return to the movie in fullscreen which we are watching)

I want to implement the same behavior in my android app.

enter image description here


Solution

  • The first check which activity is going to paused state when the app goes picture in picture on that activity onResume() method add this code.

    @Override
        protected void onResume() {
            super.onResume();
            SharedPreferences sharedpreferences = getSharedPreferences("MyPrefs", Context.MODE_PRIVATE);
    
            //get boolean value from shared preferences which we are store when joining meeting button is clicked
            boolean check = sharedpreferences.getBoolean(met,false);
            if (check){
                //if meeting is going on redirect to meeting
    
                //Replace JitsiMeetAcitvity.class with your picture in picture activity class
                startActivity(new Intent(this, JitsiMeetActivity.class)
                        .addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT));
            }
        }
    

    I have used the shared preferences to keep the track of the meeting is going on or not.

    If you want to see in detail Follow this