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 „Installation“Du kannst unser KI-gestütztes Setup nutzen, um das Plugin zu installieren. Füge die Capgo Skills mit dem folgenden Befehl deinem KI-Tool hinzu:
bunx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsNutze dann 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 bevorzugst, 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 „Quick start“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: display
Abschnitt mit dem Titel „Beispiel: display“import { RichNotifications } from '@capgo/capacitor-rich-notifications';
const { id } = await RichNotifications.display({ title: 'Hello', body: 'Tap to open', channelId: 'alerts',});Häufige Stolperfallen
Abschnitt „Häufige Fallstricke“- Listener: Handles beim Unmounten von Screens entfernen.
- Nativer Sync: ausführen
bunx cap syncnach Plugin-Upgrades. - Single Source of Truth: Vertrauen
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.
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);});