Open url on external browser task

This commit is contained in:
yostyle 2021-10-28 17:36:27 +02:00
parent c22d3fbedc
commit 31ec8d39d8
1 changed files with 2 additions and 0 deletions

View File

@ -76,6 +76,8 @@ fun openUrlInExternalBrowser(context: Context, url: String?) {
fun openUrlInExternalBrowser(context: Context, uri: Uri?) { fun openUrlInExternalBrowser(context: Context, uri: Uri?) {
uri?.let { uri?.let {
val browserIntent = Intent(Intent.ACTION_VIEW, it).apply { val browserIntent = Intent(Intent.ACTION_VIEW, it).apply {
// Open activity on browser task and not on element task
flags = Intent.FLAG_ACTIVITY_NEW_TASK
putExtra(Browser.EXTRA_APPLICATION_ID, context.packageName) putExtra(Browser.EXTRA_APPLICATION_ID, context.packageName)
putExtra(Browser.EXTRA_CREATE_NEW_TAB, true) putExtra(Browser.EXTRA_CREATE_NEW_TAB, true)
} }