Push notifications - setBackgroundMessageHandler

Hi everyone,

I am following the docs here to add push notifications into my (only in iOS atm) react-native app following this guide: https://docs.sendbird.com/javascript/push_notifications

So far I have successfully requested notification permission from the user, received the APNS token and registered it with send bird (up to step 3 in the guide):

I am now trying to register the message handlers but not receiving any remote messages from send bird (using @react-native-firebase/messaging):

  1. I have added in
    image

image

  1. I am testing by sending a message in a group chat that the registered user is in and expect to see this come through in their console log

  2. No console log statements are coming through - assuming that I am not receiving the background messages, am I missing a step?

Any help you could provide in filling in the blanks would be greatly appreciated

Hi @emmad Are you getting right type of token at step 1? https://rnfirebase.io/reference/messaging#getAPNSToken

And your catch block is not about registering token to SB but firebase getToken. I doubt getting an error from SB register token would fall into catch block

Hi Woo

I have refactored my code and getting success messages for sending the APNS token to SB, same for FCM token. I can also see them in the User section in the Sendbird dashboard.

I am still not receiving messages from SB to my device. I have the certificates in the Notification settings and the FCM server key too.

Do you have any other ideas? Is it possible to see the logs from SB server to check the messages are being sent?

Thanks

@emmad Can you show me how you register token to SB? success from register method is nothing more than register a key to the server. There are three possibilities:

  1. Incorrect token (please test your token with online tester such as https://www.apnstester.com/apns/
  2. uploaded certificate is not valid (this only can be verified with #1)
  3. User is online (connect to SB and foreground of the application)

Thanks so much Woo - I realised there was a delay in SB registering the user as offline but once it did the push notification came through! Fantastic!

Thanks for all your help

1 Like