📬
View DocsPush Notifications
CommunicationRegister for and handle push notifications
pushnotificationsfcmapnsmessaging
Demo
🔕
Push Notifications Disabled
Enable push notifications to receive updates
Permission Status
Unknown
Actions
Notification Channels (Android 8+)
Android requires notification channels for categorizing notifications.
Notification channels are only available on Android 8+.
Received Notifications
No notifications received yet. Send a push notification to this device to see it here.
Note: Push notifications require proper setup in your native projects. For iOS, you need APNs certificates and entitlements. For Android, you need Firebase Cloud Messaging configuration. On web, notifications use the Push API with service workers.
Usage
import { usePushNotifications } from '@classic-homes/native/svelte';
// or for React:
import { usePushNotifications } from '@classic-homes/native/react';API Reference
| Property | Type | Description |
|---|---|---|
| token | PushToken | null | Push notification token |
| isRegistered | boolean | Whether registered for push notifications |
| permissionState | PermissionState | null | Current permission state |
| isLoading | boolean | Whether an operation is in progress |
| error | Error | null | Current error if any |
| checkPermissions | () => Promise<PermissionState> | Check notification permissions |
| requestPermissions | () => Promise<PermissionState> | Request notification permissions |
| register | () => Promise<void> | Register for push notifications |
| unregister | () => Promise<void> | Unregister from push notifications |
| createChannel | (channel: NotificationChannel) => Promise<void> | Create notification channel (Android) |
| deleteChannel | (channelId: string) => Promise<void> | Delete notification channel (Android) |