4

In an application I am working on a Chrome Tab is used for an external OAuth flow. At the end of the flow the Custom Tab stays open with an informational message, and an email is sent that has a custom scheme link.

Until Android 10 clicking the email link would return to the app, close the tab, and continue doing whatever it needs to. To achieve that we are using an TabLauncherActivity that starts the tab and a SchemeHandlerActivity that receives the scheme from the email and launches TabLauncherActivity with FLAG_ACTIVITY_CLEAR_TOP effectively returning to the previous instance and clearing the tab and the SchemeHandlerActivity from the stack.

Enter Android 11. The app is brought to the foreground by the link but the Chrome Tab refuses to close. Closing it manually will resume the expected flow.

The application is not targeting 11 yet. I know that there are some limitations on inter-app communications but not targeting the platform I would hope that there would be no problem.

Any ideas on what the issue might be would be more than welcome.

Thanks.

MadDim
  • 543
  • 6
  • 22

1 Answers1

2

Use the flag Intent.FLAG_ACTIVITY_NO_HISTORY for your Custom Tab intent:

customTabsIntent.intent.flags = Intent.FLAG_ACTIVITY_NO_HISTORY

So the Custom Tab will no longer be here when you return to the app.

Cyril
  • 580
  • 2
  • 11
  • 23