I have a LiveChat activity having noHistory in AndroidManifest.xml. LiveChat activity open file chooser to choose image or video.
The problem is that when file chooser open it finish the activity because of noHistory set in activity.
I have to keep noHistory flag with activity because LiveChat activity is PiP activity and when it finish it open two instances of App. I want activity should not finish when file chooser is open.
I try below snip of code when opening file chooser
getIntent().removeFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
but its not working. Is it possible to do so. Thanks
If someone faces the same problem he/she can close multiple instances of PiP without using FLAG_ACTIVITY_NO_HISTORY using below snip of code.
@Override
public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode, Configuration newConfig) {
super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig);
if (getLifecycle().getCurrentState() == Lifecycle.State.CREATED) {
finishAndRemoveTask();
//when user click on Close button of PIP this will trigger, do what you want here
}
else if (getLifecycle().getCurrentState() == Lifecycle.State.STARTED){
//when PIP maximize this will trigger
}
}