I want to check if the user has disabled his chrome on android phone. It's not related to customs tabs at all, I just want if chrome is disabled. My use case is we run ES6 JS in web view, in N OS we force upgrade user to update his chrome if it is lesser than the minimum version required to run ES6. It was good, and our app is working great. Hold on, one day we realize the user can also disable chrome and does not want to enable/update it at all. I know "android system webview" is also available on the play store but it can only be updated if chrome is disabled.
Now I need to know how can I know if chrome is disabled, Is there any good way of doing that?
CodePudding user response:
Use this function
boolean isAppEnable(String package) {
return getPackageManager().getApplicationInfo(package, 0).enabled;
}
Chrome's package name is com.android.chrome
CodePudding user response:
I got my answer: ApplicationInfo applicationInfo = getPackageManager().getApplicationInfo("chrome_package_name", 0); boolean isAppEnabled = applicationInfo.enabled;
reference: https://developer.android.com/reference/android/content/pm/ApplicationInfo.html#enabled