How to Show Notifications in React Native?

  • Updated

The following steps on the assumption that you have already registered in Qiscus chat SDK.

Step 1: Install React Native Firebase Library

We recommend to use react-native-firebase library, this library is easy to setup FCM (Firebase Cloud Message). To setup, you need to do:

  1. Go to Installation menu to initial setup,
  2. Then you can install for specific platform:

      3. Install Firebase Cloud Messaging dependency for specific platform:

      4. Install RNFirebase Notification package for specific platform:

Step 2: Register FCM Server Key to Qiscus Chat SDK

You can follow this steps to register:

  1. Go to this link to retrieve the FCM server key
  2. Then go to this link to register your FCM server key to Qiscus chat SDK

Step 3: Register FCM Token to Qiscus Chat SDK

You need to make sure every time open the app, the FCM token need to be registered in Qiscus chat SDK server. Once the device token has been registered, the target user will receive the notification.

mceclip0.png

Step 4: Handling Incoming Message from Push Notification

You can handle receiving message by following this link, also for the notifications you can follow this steps instructions. This below sample code to handle incoming the notification:

mceclip1.png

Step 5: Handle Push Notification Event

You can handle notification event for example when open the notification, by following this link. This below code an example when redirect to particular chat room:

mceclip2.png

If you still having trouble to setup push notification, you can reach out to our support team so we can help you!

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.