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.
インストール
「インストール」のセクションCapgoのAI-Assisted Setupを使用してプラグインをインストールできます。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大部分ユーザーにとって、 主なQuickstartガイド 主なQuickstartガイドでは、プラグインのインストールとCapgoクラウド統合について説明しています。
このガイドでは、プログラムの詳細について説明し、自社で更新を実装したいユーザー向けに、プラグインの技術的な詳細を説明しています。
概要
概要The Capacitor Updater plugin enables over-the-air (OTA) updates for your Capacitor applications. This allows you to push updates to your app without going through app store reviews.
機能の仕組み
機能の仕組み- バンドルダウンロード: プラグインは、更新パッケージ (ZIP ファイルに含まれる Web アセット) をダウンロードします
- Extraction: パッケージは、デバイスのストレージに展開されます
- Hot Reload: アプリは、再起動なしで新しいパッケージに切り替わります
- Fallback: 更新が失敗した場合、アプリは前の正常に動作していたバージョンに戻ります
Usage Modes
セクション「Usage Modes」1. Auto-Update Mode (Recommended)
セクション「1. Auto-Update Mode (Recommended)」自動更新管理とともにプラグインを使用する最も簡単な方法:
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// Plugin handles everything automatically// Configure in capacitor.config.tsあなたのプロジェクトに追加 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
AndroidNo additional configuration is required. The plugin works out of the box.
Basic API Usage
Basic API UsageUpdate Download
Copy to clipboardimport { 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);Copy to clipboard
Bundle Reload// Set bundle to be used on next app startawait CapacitorUpdater.set({ id: bundle.id});Active Bundle Setting
「再構築に新しいパッケージを使用する」セクション// Reload app immediately with new bundleawait CapacitorUpdater.reload();パッケージの一覧
「パッケージの一覧」セクションconst { bundles } = await CapacitorUpdater.list();console.log('Available bundles:', bundles);パッケージの削除
「パッケージの削除」セクション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' } }}統合パターン
セクション「統合パターン」「Capgo Cloud」
セクション「Capgo Cloud」始めるには簡単な方法
// 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 cloud詳細は 主なQuickstartガイド を参照してください。
自主管理の更新
セクションのタイトル “自主管理の更新”自主管理の更新サーバーをホストする:
// 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"}詳細は Self-Hostedモード 詳細はこちら。
手動更新フロー
「手動更新フロー」のセクション更新の完全な制御:
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();}ベストプラクティス
「ベストプラクティス」のセクション- 常に
notifyAppReady()アプリが正常に起動したときに呼び出す - 更新をテストするには、実際に生産環境にプッシュする前に十分にテストする
- ネットワークエラーのための適切なエラーハンドリングを実装する
- バージョン番号を一貫して使用する
- ダウンロードが速くなるように、バンドルサイズを小さくしてください。
- アップデートの成功率を監視する
- Plugin API Reference - Complete API documentation
- 次のステップ プラグイン __CAPGO_KEEP_0__ リファレンス
- - __CAPGO_KEEP_0__ ドキュメントの完成 プラグイン設定
- - 全ての構成オプション イベント(Events) - アップデートイベントの利用可能なもの(available update events) 自己ホストモード(Self-Hosted Mode) - 自分でアップデートサーバーを実行する
- ローカル開発 - ローカルでアップデートをテストする
- デバッグ - トラブルシューティング ガイド
サポート
- サポート- サポート 知られている問題
- GitHub Discussions __CAPGO_KEEP_0__ の議論
- - コミュニティ サポート ディスコード (Discord) -リアルタイムチャット
続ける
「続ける」Capgoを使用している場合 Capgo Capgoと連携する Using @capgo/capacitor-updater for the native capability in Using @capgo/capacitor-updater, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, プラグインの追加または更新 Capgoのプラグインの追加または更新の実装詳細については、 Ionic Enterprise プラグインの代替 Capgoのプラグインの代替の製品ワークフローについては