android Picture in Picture mode

722 views Asked by At

I have an app with 2 activities, the first one is a list of movies and the second one is detail activity and has a player that can play in PictureInPicture Mode. the problem is if the user kills the app from recent items PictureinPicture window will live on and because the app was streaming and now the connection is lost, PictureinPicture will enter a zombie mode and won't work properly. what can I do to solve this problem? in the youtube app, when the activity is in PictureInPicture mode the app is not shown in recent items, I'm not sure how to achieve this solution.

1

There are 1 answers

1
snachmsm On

which solution do you want to achieve? if you are talking about "not shown in recent items" then you may add excludeFromRecents flag to your Activitys declaration in manifest (some details in HERE)

android:excludeFromRecents

Whether or not the task initiated by this activity should be excluded from the list of recently used applications, the overview screen. That is, when this activity is the root activity of a new task, this attribute determines whether the task should not appear in the list of recent apps. Set "true" if the task should be excluded from the list; set "false" if it should be included. The default value is "false".

you may also determine this feature with Intent flag

intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);

there is also android:noHistory flag, may be useful for your case