What happens if I don't use launchMode "singleTask" in android?

550 views Asked by At

I am implementing picture in picture mode. Documentation says you can use android:launchMode="singleTask" and override onNewIntent(). If I does so, it calls onConfigurationChanged() (if activity is in picture in picture mode). So, I don't want this.

What happens if I don't use singleTask launchMode? Does it will cause some problems or bugs when that particular activity is launched for the second time?

1

There are 1 answers

1
tronku On

For PIP, using singleTask is ideal as it will create a whole different stack for handling PIP features. If the user is in pip mode and if the user clicks on the app icon, no new task will be created, the same task will be reused and intent will be passed to onNewIntent(Intent intent) method. By this way, we can implement pip in single activity app as we don't have to maintain backstack in a single activity.