Android App link - Open a url from app in browser without triggering App Link
String data = "example.com/your_url?param=some_param";
Intent defaultBrowser = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN, Intent.CATEGORY_APP_BROWSER);
defaultBrowser.setData(data);
startActivity(defaultBrowser);
this technique (using makeMainSelectorActivity) will force the link to open in the device's default browser
Note - makeMainSelectorActivity only works for API level 15 and above.
If you need to support API levels lower than 15, you could try this hack
In Kotlin
, try using makeMainSelectorActivity :
val defaultBrowser = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN, Intent.CATEGORY_APP_BROWSER)
defaultBrowser.data = Uri.parse("https://yoururl.com/")
startActivity(defaultBrowser)