Android 设置
复制一个包含安装步骤和本插件的完整 Markdown 指南的配置提示。
该插件是 Android-first 的,并执行本机 WebView 提供商版本检查。
Android 支持矩阵
Android 支持矩阵- API 22+ (Android 5.1 或更高)
- Android 5-6 和 10+: Android System WebView 提供商
- Android 7-9: Google Chrome 提供商
默认行为(主要用例)
默认行为(主要用例)默认模式是 Browserslist-style 兼容性:
minimumDeviceSharePercent默认值3- 数据集在构建时从 caniuse 数据中打包
- 除非您设置了
versionShareApiUrl
import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = { plugins: { WebviewVersionChecker: {}, },};
export default config;基本插件配置
基本插件配置import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = { plugins: { WebviewVersionChecker: { autoPromptOnOutdated: true, }, },};
export default config;高级阈值模式(自定义数据集)
高级阈值模式(自定义数据集)import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = { plugins: { WebviewVersionChecker: { minimumDeviceSharePercent: 3, versionShareByMajor: { '137': 58.2, '136': 21.3, '135': 4.6, '134': 2.1, }, }, },};
export default config;versionShareByMajor 说明:
- key = 主 WebView 版本(例如
137) - value = 分享百分比(
0..100) minimumDeviceSharePercent: 3表示“当前主版本号 >= 数据集中 3% 的分享百分比时才兼容”
您也可以通过以下方式提供数据集: versionShareApiUrl __CAPGO_KEEP_0__
{ "versionShareByMajor": { "137": 54.2, "136": 23.8 } }{ "shareByMajor": { "137": 54.2, "136": 23.8 } }{ "versions": [{ "major": 137, "share": 54.2 }, { "version": "136.0.0.0", "percent": 23.8 }] }