Skip to content

A simple Swift & React Native application to test notification delivery and reliability

Notifications You must be signed in to change notification settings

Kajatin/notification-tester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Push Notifications 🔔

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.

Swift

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.

React Native

The RN implementation of the same app. This one uses notifee to handle notifications. Push notifications are powered by Firebase Cloud Messaging.

Build

My workflow for building and testing the app on a physical device is as follows:

  1. cd react-native
  2. npm install
  3. npx expo prebuild
  4. npx expo run:ios --device or npx expo run:android

Firebase Messaging Setup

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 in react-native/ios/ for iOS
  • google-services.json should be placed in react-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:

  1. cd node
  2. npm install
  3. npm run send