はじめに
このプラグインのインストールステップとフルマークダウンガイドのセットアッププロンプトをコピーしてください。
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.
インストール
「インストール」のセクションCapgoのAIアシストセットアップを使用してプラグインをインストールできます。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 Setupを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
-
パッケージのインストール
ターミナル画面 bun add @capgo/capacitor-webview-version-checker -
ネイティブプロジェクトを同期
ターミナルウィンドウ bunx cap sync -
オプション: プラグイン設定を追加 デフォルト値 (
WebviewVersionChecker: {}) を使用するか、またはカスタマイズしたプロンプトと閾値の動作を "capacitor.config.ts.
"セクションに記載されているデフォルトの動作 (主な使用方法)"
このプラグインのデフォルトの動作は、ブラウザリストスタイルの互換性のルールを使用します:デフォルト値は
minimumDeviceSharePercentデータセットの共有は、ビルド時にcaniuseデータからバンドルされます3- セクションのタイトル “デフォルトの動作 (主な使用方法)”
- デフォルトフローでは、実行時データセット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あなたのカスタムマップは、メジャーバージョン => パーセンテージです。- あなたがリモートデータを使用したい場合は
versionShareApiUrlCapgoのプラグインを使用する方法{ "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を使用した高度な使用方法
「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,});Why use this plugin instead of only Capacitor config
Section titled “Why use this plugin instead of only Capacitor config”Capacitor supports static minimum checks:
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から続けてください」のセクションあなたが使用している場合 Getting Started Getting Startedを使用して、ネイティブメディアとインターフェイスの動作を計画する場合、接続してください Capgoを使用した@capgo/capacitor-webview-version-checker Capgoを使用した@capgo/capacitor-webview-version-checkerのネイティブ機能 Capgoを使用した@capgo/capacitor-live-activities Capgoを使用した@capgo/capacitor-live-activitiesのネイティブ機能 @capgo/capacitor-live-activities Capgoを使用した@capgo/capacitor-live-activitiesの実装詳細 Capgoを使用した@capgo/capacitor-video-player Capgoを使用した@capgo/capacitor-video-playerのネイティブ機能 @capgo/capacitor-video-player Capgoを使用した@capgo/capacitor-video-playerの実装詳細