我可以在 Chrome 39 中制作一个运行 Web 视图的 Android 应用程序吗?

Can I make an Android app that runs a web view in Chrome 39?

我正在开发一个 Android 应用程序,它是一个嵌入到网络视图中的网页。该网页使用网络音频 API。看起来 Chrome 39 for Android 支持 API,但基本 Android 浏览器的版本不支持:http://caniuse.com/#search=web%20audio%20api

我可以在 Android 设备上检测到对 Chrome 39 的支持吗?并使用 Chrome 39?

打开网页

如果he/she没有,请用户下载?

您可以使用 PackageManager 查询是否安装了 chrome (com.android.chrome),然后检索版本信息。

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
}