Implementation of a simple push notifications app in both Swift and React Native. It is meant to test the reliability of notifications on iOS and Android devices.
Send and receive simple test notification on the device. This app uses the UNUserNotificationCenter
to schedule a single or repeating notifications for you to test their reliability.
Native push notifications are not yet supported.
The RN implementation of the same app. This one uses notifee to handle notifications. Push notifications are powered by Firebase Cloud Messaging.
My workflow for building and testing the app on a physical device is as follows:
cd react-native
npm install
npx expo prebuild
npx expo run:ios --device
ornpx expo run:android
In order for your app to connect to a Firebase instance, you'll need to add the following credential files:
GoogleService-Info.plist
should be placed inreact-native/ios/
for iOSgoogle-services.json
should be placed inreact-native/android/app/
for Android
Additionally, for the node
backend to be able to send messages, you'll need the
service account credentials JSON file and set the path in the GOOGLE_APPLICATION_CREDENTIALS
environment variable. You should also set FIREBASE_MESSAGING_APNS_TOPIC
to the bundle ID
of your app.
When you launch the app, the device will log its token to the console. You can use this token
to send messages to the device with the messenger.js
script. Make sure to set the
FCM_TOKEN
environment variable to the token you want to send the message to.
To set up the backend, follow these steps:
cd node
npm install
npm run send