I have a WebView that loads a HTML with links inside. Those links are opened using Chrome Custom Tabs.
Strange scenario:
- Open Chrome browser
- Open app
- Press any link (this will open a Chrome Custom Tab)
- Press the back button or the "x" button on the Custom Tab
- Instead of going back to the app the chrome browser is shown.
[updated]
The launch mode of my activity, set in the AndroidManifest, is singleInstance.
The problem is that my activity had the launch mode "singleInstance". Changing to "singleTask" or not having a launchMode set in the AndroidManifest solves the problem.
Don't know why is that. If you know why, I will gladly mark your explanation as the solution.
This can also happen if you use the application context instead of an activity context.
add android:noHistory="true"
to manifest.xml
where you've defined activity. It is working perfectly