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-auto`
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/auto/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-auto` plugin in my project.Manual Setup を使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください:
-
パッケージをインストール
ターミナル画面 npm i @capgo/capacitor-auto -
ネイティブプロジェクトを同期
ターミナル画面 npx cap sync -
root car テンプレートを設定
import { Auto } from '@capgo/capacitor-auto';await Auto.setRootTemplate({title: 'Garage',sections: [{header: 'Doors',items: [{id: 'open-main-door',title: 'Open main door',subtitle: 'Tap to send the action to the phone app',payload: { doorId: 'main' },},],},],}); -
車用アクションを処理
await Auto.addListener('carAction', async (event) => {if (event.id === 'open-main-door') {await openGarageDoor(event.payload?.doorId);}}); -
接続状態を追跡
const status = await Auto.isAvailable();console.log(status.available, status.connected, status.platform);await Auto.addListener('connectionChanged', (event) => {console.log('Car connected:', event.connected, event.platform);});
空の状態
「空の状態」のセクションセット emptyText テンプレートが行がない場合:
await Auto.setRootTemplate({ title: 'Garage', emptyText: 'No actions are available right now.', sections: [],});ブリッジメッセージを送信
セクションのタイトル “ブリッジ メッセージを送信”Use sendMessage アプリ定義のネイティブ ブリッジ メッセージのために:
await Auto.sendMessage({ type: 'status', payload: { online: true },});プラットフォームのセットアップ
セクションのタイトル “プラットフォームのセットアップ”- Cloudflareの iOSのセットアップ CapacitorのページでCarPlayのシーンと特権に関する注釈を参照してください。
- Cloudflareの Androidのセットアップ CapacitorのページでAndroid Autoのカテゴリとマニフェストに関する注釈を参照してください。
Getting Startedから続けてください
Getting Startedから続けてくださいというセクション__CAPGO_KEEP_0__を使用している場合 Getting Started native pluginの作業計画に使用する場合、__CAPGO_KEEP_0__を__CAPGO_KEEP_1__に接続します capgo/capacitor-autoを使用してnative capabilityを接続 for the native capability in Using @capgo/capacitor-auto, Capgo Plugin Directoryを使用して製品ワークフローを実行 Capgo Plugins by __CAPGO_KEEP_1__ Capacitor Plugins by Capgoを使用して実装詳細を確認 for the implementation detail in Capacitor Plugins by Capgo, native pluginの作業計画に使用する場合、__CAPGO_KEEP_0__を__CAPGO_KEEP_1__に接続します 実装詳細の追加または更新の場合の実装詳細について Ionic Enterprise プラグインの代替 Ionic Enterprise プラグインの製品ワークフローについて