I have a app that is a share target. It is a single activity architecture with launchMode="singleTask" in the manifest.
All other apps when sharing their data to my app, seem to honor this, so, the same instance gets opened, even if the activity was previously opened.
However Google Files always seem to force a new instance of my Activity and it always stays in their task.
I debugged the intent flags, but I'm not too smart from that:
FLAG_ACTIVITY_FORWARD_RESULT|FLAG_ACTIVITY_NEW_TASK|FLAG_ACTIVITY_PREVIOUS_IS_TOP|FLAG_GRANT_READ_URI_PERMISSION|FLAG_RECEIVER_FOREGROUND
How can I prevent this? I do NOT want more than 1 instance of my single Activity. Not even launchMode="singleInstance" works.
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize|stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
</activity>