Getting Started
このプラグインのインストール手順とフルマークダウンガイドを含むセットアッププロンプトをコピーします。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-updater`
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/updater/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アシストされたセットアップを使用してプラグインをインストールできます。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-updater` plugin in my project.Manual Setupを使用する場合は、以下のコマンドを実行してプラットフォーム固有の指示を参照してください。
bun add @capgo/capacitor-updaterbunx cap syncyarn add @capgo/capacitor-updaterbunx cap syncpnpm add @capgo/capacitor-updaterbunx cap syncbun add @capgo/capacitor-updaterbunx cap syncQuick Start
「Quick Start」セクション大多数ユーザーにとって、プラグインのインストールと__CAPGO_KEEP_0__クラウド統合の両方をカバーする主なQuickstartガイドを実行することをお勧めします。 このガイドは、主なQuickstartガイドとは異なり、技術的なプラグインの詳細に焦点を当てており、内部メカニズムを理解したり、自社ホストの更新を実装したりしたい高度なユーザー向けです。 which covers both the plugin installation and Capgo cloud integration.
「概要」セクション
For most users, we recommend following the
main Quickstart guideThe Capacitor アップデーター プラグインは、Capacitor アプリケーション向けのオーバー・ザ・エア (OTA) アップデートを有効にします。この機能により、App Storeのレビュー手順を経ることなく、アプリにアップデートをプッシュできます。
How It Works
Section titled “How It Works”- Bundle Download: プラグインは、ZIPファイルに含まれるウェブアセットを含むアップデートバンドルをダウンロードします。
- Extraction: バンドルは、デバイスのストレージに抽出されます。
- Hot Reload: アプリは、新しいバンドルに切り替わり、再起動が必要なくなる。
- Fallback: アップデートが失敗した場合、アプリは前の正常に動作していたバージョンに戻ります。
Usage Modes
使用方法1. 自動更新モード (推奨)
1. 自動更新モード (推奨)自動更新を管理するための自動更新モードで、最も簡単な方法です。
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// Plugin handles everything automatically// Configure in capacitor.config.ts__CAPGO_KEEP_0__ capacitor.config.ts:
{ plugins: { CapacitorUpdater: { autoUpdate: 'atBackground', updateUrl: 'https://your-update-server.com/api/updates' } }}2. 手動モード
2. 手動モード更新プロセスの高度な制御を実現するために使用します。
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// Download an updateconst bundle = await CapacitorUpdater.download({ url: 'https://your-server.com/updates/v1.0.1.zip', version: '1.0.1'});
// Set the bundle (will be used on next app start)await CapacitorUpdater.set({ id: bundle.id});
// Or reload immediatelyawait CapacitorUpdater.reload();プラットフォーム設定
プラットフォーム設定iOS
セクション「iOS」追加の設定は必要ありません。プラグインは箱から出てきます。
Android
セクション「Android」追加の設定は必要ありません。プラグインは箱から出てきます。
基本API使用方法
セクション「基本API使用方法」更新をダウンロード
セクション「更新をダウンロード」import { CapacitorUpdater } from '@capgo/capacitor-updater';
const bundle = await CapacitorUpdater.download({ url: 'https://example.com/update.zip', version: '1.0.1'});
console.log('Downloaded bundle:', bundle.id);Set Active Bundle
Section titled “Set Active Bundle”// Set bundle to be used on next app startawait CapacitorUpdater.set({ id: bundle.id});Reload with New Bundle
Section titled “Reload with New Bundle”// Reload app immediately with new bundleawait CapacitorUpdater.reload();List Bundles
Section titled “List Bundles”const { bundles } = await CapacitorUpdater.list();console.log('Available bundles:', bundles);Delete a Bundle
Section titled “Delete a Bundle”await CapacitorUpdater.delete({ id: 'bundle-id'});現在のバンドルを取得
現在のバンドルを取得const { bundle } = await CapacitorUpdater.current();console.log('Current bundle:', bundle.version);イベントリスナー
イベントリスナー更新イベントをリスンする
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// Listen for download progressCapacitorUpdater.addListener('download', (info) => { console.log('Download progress:', info.percent);});
// Listen for download completionCapacitorUpdater.addListener('downloadComplete', (bundle) => { console.log('Download complete:', bundle.version);});
// Listen for update failuresCapacitorUpdater.addListener('updateFailed', (error) => { console.error('Update failed:', error);});
// Listen for successful updatesCapacitorUpdater.addListener('updateAvailable', (info) => { console.log('Update available:', info.version);});設定オプション
設定オプションプラグインをあなたの capacitor.config.ts:
{ plugins: { CapacitorUpdater: { // Auto-update settings autoUpdate: 'atBackground', updateUrl: 'https://api.example.com/updates',
// Update behavior resetWhenUpdate: true,
// Version settings version: '1.0.0',
// Security allowModifyUrl: false,
// Stats collection statsUrl: 'https://api.example.com/stats',
// Channel (for Capgo cloud) defaultChannel: 'production' } }}With Capgo Cloud
Section titled “With Capgo Cloud”The easiest way to get started:
// Install the Capgo CLIbun add -g @capgo/cli
// Login to Capgonpx @capgo/cli login
// Upload your first bundlenpx @capgo/cli bundle upload
// The plugin auto-updates from Capgo cloudSee the main Quickstart guide for details.
Self-Hosted Updates
Section titled “Self-Hosted Updates”Host your own update server:
// Configure your update endpoint{ plugins: { CapacitorUpdater: { autoUpdate: 'atBackground', updateUrl: 'https://your-server.com/api/check-update' } }}サーバーは次の値を返す必要があります。
{ "version": "1.0.1", "url": "https://your-server.com/updates/1.0.1.zip"}See Self-Hosted Mode 詳細は「Self-Hosted Mode」でご確認ください。
Manual Update Flow
セクション「Manual Update Flow」更新の完全な制御:
import { CapacitorUpdater } from '@capgo/capacitor-updater';
async function checkAndUpdate() { // Check for updates from your server const response = await fetch('https://api.example.com/check-update'); const { version, url } = await response.json();
// Download the update const bundle = await CapacitorUpdater.download({ url, version });
// Notify bundle is ready await CapacitorUpdater.notifyAppReady();
// Set as next version await CapacitorUpdater.set({ id: bundle.id });
// Reload when ready await CapacitorUpdater.reload();}Best Practices
セクション「Best Practices」- 常に呼び出す
notifyAppReady()アプリが正常に読み込まれたとき - 生産環境にプッシュする前に、テストを徹底的に行ってください
- ネットワークエラーの際に適切なエラーハンドリングを実装してください
- バージョン番号を一貫して使用してください
- ダウンロードが速くなるように、バンドルサイズを小さくしてください
- アップデートの成功率を監視してください
次のステップ
「次のステップ」- プラグイン API リファレンス - API ドキュメントの完成
- プラグイン設定 - 全ての構成オプション
- イベント - 利用可能なアップデートイベント
- 自主ホストモード - 自分でアップデートサーバーを実行
- ローカル開発 - ローカルでアップデートをテスト
- デバッグ - トラブルシューティングガイド
サポート
サポートセクション- 既知の問題 - 共通の問題と解決策
- GitHub 私の管理 - 今年会風管理
- Discord - 日当管理読管理
当前に設定です。コンタイントを为いに定义しています
コンタイントを为いに定义していますコンタイントを为いに定义しています コンタイントを为いに定义しています コンタイントを为いに定义しています。コンタイントを为いに定义しています Using @capgo/capacitor-updater for the native capability in Using @capgo/capacitor-updater, Capgo Plugin Directory 製品ワークフローについての情報は、Capgo プラグインディレクトリで確認できます。 Capacitor プラグインは、Capgo によって提供されています。 for the implementation detail in Capacitor Plugins by Capgo, プラグインの追加または更新 製品ワークフローについての情報は、プラグインの追加または更新で確認できます。 Ionic Enterprise プラグインの代替 製品ワークフローについての情報は、Ionic Enterprise プラグインの代替で確認できます。