내용으로 건너뛰기

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 Setup을 선호한다면, 플러그인을 설치하기 위해 다음 명령어를 실행하고 아래에 플랫폼에 따라 설명된 지침을 따르세요:

  1. 패키지를 설치하세요

    터미널 창
    npm i @capgo/capacitor-auto
  2. __CAPGO_KEEP_1__

    __CAPGO_KEEP_2__
    npx cap sync
  3. __CAPGO_KEEP_3__

    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_4__

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

    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 },
});
  • Follow the iOS 설정 CarPlay scene 및 권한 노트 페이지를 위한
  • Follow the Android 설정 Android Auto 카테고리 및 매니페스트 노트 페이지를 위한

Getting Started에서 계속

Getting Started에서 계속하는 방법

Getting Started을 사용하여 Getting Started 자연스러운 네이티브 플러그인 작업을 계획하고 있다면 @capgo/capacitor-자동 capgo/capacitor-자동 기능을 사용하는 데 필요한 네이티브 기능 Capgo 플러그인 폴더 Capgo 플러그인 디렉토리 내의 제품 워크플로우에 대해. Capacitor Capgo 플러그인들에 의해 Capgo Capacitor 플러그인에 대한 구현 세부 사항은 Capgo에 의해 제공됩니다. 플러그인을 추가하거나 업데이트 합니다. for the implementation detail in Adding or Updating Plugins, and Capacitor Enterprise Plugin Alternatives Ionic Enterprise 플러그인 대체 제품 워크플로우를 위해.