Panduan Memulai
Salin prompt setup yang berisi langkah install 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-rich-notifications`
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/rich-notifications/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.
Anda bisa menggunakan AI-Assisted Setup kami untuk menginstal plugin ini. Tambahkan skill Capgo ke tool AI Anda dengan command berikut:
bunx 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-rich-notifications` plugin in my project.Jika Anda lebih memilih Manual Setup, instal plugin dengan menjalankan perintah berikut dan ikuti petunjuk khusus platform di bawah ini:
bun add @capgo/capacitor-rich-notificationsbunx cap syncimport { RichNotifications } from '@capgo/capacitor-rich-notifications';Mulai cepat
Bagian berjudul “Mulai cepat”import { RichNotifications } from '@capgo/capacitor-rich-notifications';
const { status } = await RichNotifications.requestPermission();if (status !== 'granted') return;Contoh: createChannel
Bagian berjudul “Contoh: createChannel”import { RichNotifications } from '@capgo/capacitor-rich-notifications';
await RichNotifications.createChannel({ id: 'alerts', name: 'Alerts', importance: 'high',});Contoh: tampilan
Bagian berjudul “Contoh: display”import { RichNotifications } from '@capgo/capacitor-rich-notifications';
const { id } = await RichNotifications.display({ title: 'Hello', body: 'Tap to open', channelId: 'alerts',});Kesalahan umum
Bagian berjudul “Kesalahan umum”- Listener: hapus handle saat screen unmount.
- Sinkronisasi Native: jalankan
bunx cap syncsetelah upgrade plugin. - Sumber kebenaran tunggal: percayai
src/definitions.tsdi repo GitHub.
Setup platform
Bagian berjudul “Platform setup”- Setup iOS untuk kategori dan level interupsi.
- Setup Android untuk
POST_NOTIFICATIONS, channel, dan izin alarm spesifik atau layanan foreground opsional.
Penggunaan
Bagian berjudul “Usage”import { RichNotifications } from '@capgo/capacitor-rich-notifications';
await RichNotifications.requestPermission();
await RichNotifications.createChannel({ id: 'messages', name: 'Messages', importance: 'high',});
await RichNotifications.display({ title: 'Hello', body: 'Tap to open the app', channelId: 'messages',});
await RichNotifications.addListener('press', (event) => { console.log(event.id, event.actionId, event.input);});