Erste Schritte
Kopiere einen Setup-Prompt mit den Installationsschritten und dem vollständigen Markdown-Guide für dieses Plugin.
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.
Installieren
Abschnitt mit dem Titel „Installation“Du kannst unser KI-gestütztes Setup nutzen, um das Plugin zu installieren. Füge deinem KI-Tool die Capgo Skills mit folgendem Befehl hinzu:
bunx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsNutze anschließend diesen Prompt:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-rich-notifications` plugin in my project.Wenn du ein manuelles Setup bevorziehst, installiere das Plugin mit den folgenden Befehlen und befolge die plattformspezifischen Anweisungen unten:
bun add @capgo/capacitor-rich-notificationsbunx cap syncImportieren
Abschnitt mit dem Titel „Import“import { RichNotifications } from '@capgo/capacitor-rich-notifications';Quickstart
Abschnitt mit dem Titel „Quickstart“import { RichNotifications } from '@capgo/capacitor-rich-notifications';
const { status } = await RichNotifications.requestPermission();if (status !== 'granted') return;Beispiel: createChannel
Abschnitt mit dem Titel „Beispiel: createChannel“import { RichNotifications } from '@capgo/capacitor-rich-notifications';
await RichNotifications.createChannel({ id: 'alerts', name: 'Alerts', importance: 'high',});Beispiel: Anzeige
Abschnitt mit dem Titel „Beispiel: Anzeige“import { RichNotifications } from '@capgo/capacitor-rich-notifications';
const { id } = await RichNotifications.display({ title: 'Hello', body: 'Tap to open', channelId: 'alerts',});Häufige Fehlerquellen
Abschnitt mit dem Titel „Häufige Fehlerquellen“- Listener: Handles entfernen, wenn Screens unmounten.
- Native Sync: ausführen
bunx cap syncnach Plugin-Upgrades. - Single Source of Truth: vertraue
src/definitions.tsim GitHub Repo.
Plattform-Setup
Abschnitt mit dem Titel „Plattform-Setup“- iOS-Setup für Kategorien und Unterbrechungsstufen.
- Android-Setup für
POST_NOTIFICATIONS, Channels sowie optionale Berechtigungen für exakte Alarme oder Foreground Services.
Anwendung
Abschnitt mit dem Titel „Anwendung“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);});