1 year ago
#228447
luislukas
Android 12 - Opening a https intent causes app to restart activity and then launches browser
I'm seeing a strange behaviour only happening on android 12 devices.
- In a
Fragment
of the app we tap to open a link in the browser like this:Intent(Intent.ACTION_VIEW, Uri.parse(link))
and thenstartActivity(intent)
- The link is to our own website which has the host verified.
- What happens then is the
MainActivity
is destroyed and restarted and afterwards, the browser opens. - The app is based on a single activity with
Fragments
and haslaunchMode=singleTask
- Devices running other than android 12 just open the browser and when going back the app is at the last
Fragment
visited - this is the desired behaviour and what I would expect as well.
A note on this is that the app handles deep links correctly. It also has the autoVerify enabled and the setup for the assetLinks.json is correct - the app open automatically when clicking a link.
My lines of thought is that the changes introduced around deep links and autoVerify
must be causing this. If we swap the link for https://www.google.com
it doesn't destroy the MainActivity
and we can visit the website and go back to the app. Any other link with one of our hosts causes that behaviour.
Curious if anyone has experience the same. We are thinking in opening a webview inside to avoid this as a temporal solution but it wouldn't be ideal to do so.
android
deep-linking
android-12
android-api-31
0 Answers
Your Answer