Documentation Index
Fetch the complete documentation index at: https://docs.a0.dev/llms.txt
Use this file to discover all available pages before exploring further.
Push Notifications
a0 provides built-in push notification delivery through FCM (Android) and APNs (iOS). Your Convex backend sends notifications via a0’s API — no third-party push services needed.How it works
- Your app collects device push tokens using
expo-notifications - Your Convex backend calls
internal.notifications.sendNotification - a0 detects the platform from the token and delivers via FCM or APNs
convex/notifications.ts file is automatically included in your project. It’s an internal action — only your server-side Convex functions can call it, not the client.
Getting a device push token
UsegetDevicePushTokenAsync() from expo-notifications — not getExpoPushTokenAsync():
Sending notifications
CallsendNotification from your Convex backend using internal (not api):
| Argument | Type | Required | Description |
|---|---|---|---|
to | string | string[] | Yes | Device push token(s) |
title | string | Yes | Notification title |
body | string | Yes | Notification body |
data | Record<string, string | number | boolean | null> | No | Custom data payload |
badge | number | No | App icon badge count (iOS) |
Android Setup
Follow the Android FCM Setup guide to configure Firebase Cloud Messaging credentials:- Create a Firebase project and add your Android app
- Download
google-services.json - Create a Firebase service account key (for FCM v1 delivery)
- Upload both in Project Settings → Build Settings → Android Credentials
- Create a new APK build
iOS Setup
iOS push notifications are configured per Apple Developer team:- Connect your Apple Developer account via the Publish → App Store flow
- Set up APNs credentials (automatic or manual) from the team management dialog
- Create a new App Store / TestFlight build
aps-environment entitlement is included automatically in all builds.
Handling notifications in your app
Troubleshooting
| Issue | Fix |
|---|---|
| ”no valid aps-environment entitlement” | Create a new build — older builds may not include this entitlement |
| ”BadDeviceToken” | Device token expired or from wrong environment — get a fresh token |
| ”Firebase service account is not configured” | Upload credentials in Build Settings → Android Credentials |
| ”APNs credentials are not configured” | Set up APNs key in Publish → App Store → team management |
| Notifications not received | Must test on TestFlight (iOS) or custom APK (Android), not Expo Go |