我想访问基于铬的webview的版本号,是否可以通过编程方式获得?
围绕此指针的任何指针都会有所帮助。谢谢!
答案 0 :(得分:1)
new WebView(context).getSettings().getUserAgentString();
答案 1 :(得分:1)
试试这个:
PackageManager pm = getPackageManager();
try {
PackageInfo pi = pm.getPackageInfo("com.google.android.webview", 0);
Log.d(TAG, "version name: " + pi.versionName);
Log.d(TAG, "version code: " + pi.versionCode);
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Android System WebView is not found");
}
WebView webView = new WebView(getApplicationContext());
String useragent=webView.getSettings().getUserAgentString();
Log.e(TAG, "useragent: " + useragent);