はじめに
インストール手順とフル マークダウン ガイドを含むセットアップ ポンプをコピーします。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-webview-version-checker`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/webview-version-checker/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
インストールAI-Assisted セットアップを使用してプラグインをインストールできます。次のコマンドを使用して、AI ツールに Capgo スキルを追加します。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次のプロンプトを使用してください。
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-webview-version-checker` plugin in my project.Manual セットアップを使用する場合は、次のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
-
パッケージのインストール
ターミナル bun add @capgo/capacitor-webview-version-checker -
ネイティブ プロジェクトの同期
ターミナル画面 bunx cap sync -
オプション: プラグイン設定を追加 デフォルト値 (
WebviewVersionChecker: {}) を使用するか、またはプロンプトと閾値の動作をカスタマイズできます。capacitor.config.ts.
デフォルトの動作 (主な用途)
「デフォルトの動作 (主な用途)」というセクションこのプラグインは、デフォルトではブラウザリストスタイルの互換性規則を使用します。
minimumDeviceSharePercentデフォルト値は3- データセットは、ビルド時に caniuse データからバンドルされます。
- デフォルトフローでは、ランタイムデータセットのURL呼び出しは必要ありません。
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, }, autoPromptOnOutdated: true, }, },};
export default config;このオプションを使用する場合は、実世界のシェアに基づいてのみ固定バージョンに基づく互換性を求める必要があります。
minimumDeviceSharePercent: 3インストールされているメジャーバージョンは、データセット内の少なくとも 3% を表す必要があります。versionShareByMajorあなたのカスタムマップ: メジャーバージョン => パーセンテージ- リモートデータを使用する場合は、
versionShareApiUrl以下のいずれかを使用します。{ "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 }] }
JavaScript を使用した高度な使用法
「Advanced usage with JavaScript」セクションimport { WebviewVersionChecker } from '@capgo/capacitor-webview-version-checker';
await WebviewVersionChecker.addListener('webViewOutdated', (status) => { console.log('Outdated WebView detected', status);});
await WebviewVersionChecker.check({ minimumMajorVersion: 124, showPromptOnOutdated: true,});Capacitorの代わりにこのプラグインを使用する理由
「Capacitorの代わりにこのプラグインを使用する理由」セクションCapacitorは静的最小チェックをサポートしています:
android: { minWebViewVersion: 124,},server: { errorPath: 'unsupported-webview.html',}このプラグインは、ユーザーがアプリを使用し続けながらアップデートを促すために、実行時イベントとネイティブのプロンプトUIを追加します。
評価順序:
- デバイス共有閾値モード (
minimumDeviceSharePercent+データセット)、提供された場合 - 最新バージョンモード (
latestVersion/latestVersionApiUrl) - 最小主なフォールバック (
minimumMajorVersion)
Android プロバイダー処理
セクション「Android プロバイダー処理」Capacitor の Android 上で使用される両方の WebView プロバイダー モデルをサポートしています。
- Android 5-6 と 10+: Android System WebView (
com.google.android.webview) - Android 7-9: Google Chrome (
com.android.chrome)
Getting Started から続けてください
セクション「Getting Started から続けてください」__CAPGO_KEEP_0__ を使用している場合 Getting Started ネイティブメディアとインターフェイスの動作を計画する場合、__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-webview-version-checker を使用して接続します。 Using @capgo/capacitor-webview-version-checker Using @capgo/capacitor-webview-version-checker @capgo/capacitor-live-activities Using @capgo/capacitor-live-activities @capgo/capacitor-live-activities for the native capability in @capgo/capacitor-live-activities、 @capgo/capacitor-live-activities Using @capgo/capacitor-live-activities @capgo/capacitor-live-activities for the implementation detail in @capgo/capacitor-live-activities、