コンテンツにジャンプ

Getting Started

GitHub

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-auto` plugin in my project.

Manualセットアップを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。

  1. パッケージのインストール

    ターミナル画面
    npm i @capgo/capacitor-auto
  2. __CAPGO_KEEP_0__

    ターミナル画面
    npx cap sync
  3. __CAPGO_KEEP_0__

    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' },
    },
    ],
    },
    ],
    });
  4. __CAPGO_KEEP_0__

    await Auto.addListener('carAction', async (event) => {
    if (event.id === 'open-main-door') {
    await openGarageDoor(event.payload?.doorId);
    }
    });
  5. __CAPGO_KEEP_0__

    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: [],
});

使用 sendMessage アプリケーション定義のネイティブブリッジメッセージの場合:

await Auto.sendMessage({
type: 'status',
payload: { online: true },
});

プラットフォーム設定

プラットフォーム設定
  • を参照してください iOS設定 のCarPlayシーンとエンタイトルメントに関する注釈のページ
  • を参照してください Android設定 のAndroid Auto カテゴリとマニフェストに関する注釈のページ

Getting Startedから続けてください

「Getting Started」を使用して

ネイティブプラグインの作業を計画している場合、 それを接続してください Section titled “Platform setup” Using @capgo/capacitor-auto for the native capability in Using @capgo/capacitor-auto Capgo プラグイン ディレクトリ for the product workflow in Capgo プラグイン ディレクトリ Capacitor プラグイン (Capgo による) for the implementation detail in Capacitor プラグイン (Capgo による) プラグインの追加または更新 for the implementation detail in プラグインの追加または更新 Ionic Enterprise プラグインの代替 for the product workflow in Ionic Enterprise プラグインの代替