Mulai Menggunakan
Salin prompt pengaturan dengan langkah instalasi dan panduan markdown lengkap untuk plugin ini.
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.
Pemasangan
Bab berjudul “Pemasangan”Anda dapat menggunakan Setup Bantuan AI kami untuk menginstal plugin. Tambahkan Capgo kemampuan ke alat AI Anda menggunakan perintah berikut:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsLalu gunakan prompt berikut:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-auto` plugin in my project.Jika Anda lebih suka Setup Manual, instal plugin dengan menjalankan perintah-perintah berikut dan ikuti instruksi spesifik platform di bawah ini:
-
Install the package
Jendela terminal npm i @capgo/capacitor-auto -
Sinkronkan proyek native
Jendela terminal npx cap sync -
Atur template 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' },},],},],}); -
Tangani aksi mobil
await Auto.addListener('carAction', async (event) => {if (event.id === 'open-main-door') {await openGarageDoor(event.payload?.doorId);}}); -
Track status koneksi
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);});
State kosong
Bab berjudul “State kosong”Set emptyText ketika template tidak memiliki baris:
await Auto.setRootTemplate({ title: 'Garage', emptyText: 'No actions are available right now.', sections: [],});Kirim pesan jembatan
Judul Bagian: Kirim Pesan JembatanPilih sendMessage untuk pesan jembatan native aplikasi yang ditentukan:
await Auto.sendMessage({ type: 'status', payload: { online: true },});Pengaturan Platform
Judul Bagian: Pengaturan Platform- Ikuti Pengaturan iOS halaman untuk Kategori Android Auto dan Catatan Manifest.
- Ikuti Pengaturan Android halaman untuk Catatan Entitlement dan Scene CarPlay.
Teruskan dari Getting Started
Judul Bagian “Teruskan dari Getting Started”Jika Anda menggunakan Mulai Menggunakan untuk merencanakan pekerjaan plugin native, hubungkannya dengan Menggunakan @capgo/capacitor-auto untuk kemampuan native di Menggunakan @capgo/capacitor-auto, Capgo Direktori Plugin untuk alur kerja produk di Capgo Direktori Plugin, Capacitor Plugin oleh Capgo untuk detail implementasi di Capacitor Plugin oleh Capgo, Mengambah atau Mengupdate Plugin untuk detail implementasi di Menambahkan atau Mengupdate Plugin, dan Alternatif Plugin Enterprise Ionic untuk alur produk di Alternatif Plugin Enterprise Ionic.