I\'m currently testing a webapp developed with lots of jQuery animations, and we\'ve noticed really poor performance with the built-in web browser. While testing in Chrome,
In google play there is a big variety of chrome browser apps with different features
So it's correct to check all of them
fun Context.openChrome(url: String, onError: (() -> Unit)? = null) {
openBrowser("com.android.chrome", url) {
openBrowser("com.android.beta", url) {
openBrowser("com.android.dev", url) {
openBrowser("com.android.canary", url) {
onError?.invoke() ?: openBrowser(null, url)
}
}
}
}
}
fun Context.openBrowser(packageName: String?, url: String, onError: (() -> Unit)? = null) {
try {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)).apply {
setPackage(packageName)
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
})
} catch (e: ActivityNotFoundException) {
onError?.invoke()
}
}