39609

I'm developing an Android app that's a web page embedded inside of a web view. The web page makes use of the web audio API. It looks like Chrome 39 for Android supports that API, but no version of the basic Android browser does: http://caniuse.com/#search=web%20audio%20api
Can I detect support for Chrome 39 on an Android device? And open the web page using Chrome 39?
And ask the user to download it if he/she does not have it?
Answer1:
You can use the PackageManager to query if chrome (com.android.chrome) is installed and then retrieve the version info.
try {
// Get installed Chrome package info
String chromePackageName = "com.android.chrome";
PackageInfo info = getPackageManager().getPackageInfo(chromePackageName, 0);
// Check the version number
int versionMajor = Integer.parseInt(info.versionName.subString(0, 2));
if(versionMajor < 39) {
// Chrome is installed but not updated, prompt user to update it
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + chromePackageName)));
} else {
// Chrome is installed and at or above version 39, launch the page
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://YourURLHere")));
}
} catch (NameNotFoundException e) {
// Chrome isn't installed, prompt the user to download it.
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + chromePackageName)));
} catch (NumberFormatException e) {
// Something funky happened since the first two chars aren't a number
}