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:
<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)
I opened my Safe Browser App with getting package name from Google play, the same way you can open for chrome by default also:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://Your URL"));
intent.setPackage("com.cloudacl"); // package of SafeBrowser App
startActivity(intent);
You can replace package com.cloudacl
with this com.android.chrome
to open chrome.