Open Chrome App with URL

后端 未结 8 1473
情话喂你
情话喂你 2021-02-02 14:59

Is there a way to open Chrome app on Android from default Android browser? I\'m able to open the app, but it doesn\'t redirect user to correct page. This is what I tried:

<
8条回答
  •  暖寄归人
    2021-02-02 15:26

    Android Kotlin

    Try this below code for intent to chrome browser in kotlin.

    val uri = Uri.parse("googlechrome://navigate?url="+"https://stackoverflow.com/")
    val i = Intent(Intent.ACTION_VIEW, uri)
    if (i.resolveActivity(this@MainActivity.packageManager) == null) {
       i.data = Uri.parse("https://stackoverflow.com/")
    }
    this@MainActivity.startActivity(i)
    

提交回复
热议问题