Notifications
Notification listeners, Account push-token registration, and profile-specific notification behavior.
What the template currently provides
hooks/use-push-notifications.ts configures the Expo notification foreground handler and registers listeners for received notifications and notification responses. The response listener currently logs the tapped notification; it does not route to a notification-specific screen.
The template also includes an Account notification center backed by React Query:
GET /api/v1/app/notificationsPUT /api/v1/app/notifications/{id}/readPUT /api/v1/app/notifications/read-allDELETE /api/v1/app/notifications/{id}DELETE /api/v1/app/notificationsGET/PUT /api/v1/app/notifications/preferences
The notification list query is enabled only for an authenticated Account user.
Account push registration
hooks/use-push-token.ts is Account-only. On a physical device it:
- Creates the Android notification channel.
- Requests notification permission.
- Reads the native device/FCM token with
getDevicePushTokenAsync(). - Stores it locally and posts it to
POST /api/v1/app/device-tokensafter the current user is restored.
Remote delivery therefore requires Firebase configuration, native credentials, and the Laravel admin panel's Firebase server credential. The template is not using Expo's hosted push-token service for this path.
Guest behavior
Guest mode never requests or syncs a device/FCM token. Notification preferences are local-only, and account notification queries are disabled. The shared notification handler/listener remains in the source so the runtime can receive local notifications, but the template does not provide a complete local scheduling API. Add and test a scheduling path if your Guest app needs scheduled reminders.
Required native setup
Before a native build, add the Firebase files expected by app.config.ts:
google-services.jsonfor Android.GoogleService-Info.plistfor iOS.
Also configure the EAS project ID and notification permissions for the target platforms. Test on a physical device; simulators cannot produce a real device push token.
Relevant files
hooks/use-push-notifications.tshooks/use-push-token.tsqueries/use-notifications.tsmutations/use-notification-mutations.tsstore/preferences-store.tsapp/notifications.tsxandapp/settings/notifications.tsx
