Push Notifications
Push notifications are half the reason many developers want to build a mobile app in the first place. Mosayic strongly encourages getting push notifications for both iOS and Android set up properly very early on – ideally before building your first feature or screen.
The Stack
Section titled “The Stack”Expo and EAS handle push notification installation and sending, and the process is very streamlined with these tools – which is why Mosayic advocates for them.
Under the hood, two services power push notifications:
- Firebase Cloud Messaging (FCM) – for Android
- Apple Push Notification Service (APNs) – for iOS
The Expo Push Service acts as a proxy for both FCM and APNs. This is why certain credentials need to be set up in Expo, and why Mosayic had you create a Firebase account in the early setup stages.
Token Storage
Section titled “Token Storage”In the Supabase database, the users table in the public schema has a field called fcm_token. This stores the Expo Push Token generated by your mobile app.
The Mosayic React Native template has all of this configured already. However, it’s absolutely worth checking – both locally and in the cloud – that your Supabase dashboard shows tokens being saved correctly in the Users table. If tokens aren’t being stored, push notifications definitely won’t work.
Testing Push Notifications
Section titled “Testing Push Notifications”To test push notifications, you’ll need either:
- A development build running in development mode
- The app deployed to TestFlight (iOS) or built as an APK (Android)
How It Works
Section titled “How It Works”- Your mobile app (using Expo tooling) generates an Expo Push Token
- This token gets saved to the
fcm_tokencolumn in Supabase (the Mosayic template handles this) - You can take this token and run a manual
curlcommand to test whether notifications are working
For testing, you can also use the Expo push notifications tool to quickly send a test notification to your device.
Triggering Notifications
Section titled “Triggering Notifications”How you trigger notifications is up to you. Options include:
- Supabase hooks/triggers – when a row is added to a table, trigger a notification automatically
- Python API – centralize notification logic in your backend (recommended)
- Supabase Edge Functions – an alternative, though centralizing in the API is preferable
For more details, see the Expo push notifications documentation.