# Push notifications - setBackgroundMessageHandler

**URL:** <https://community.sendbird.com/t/push-notifications-setbackgroundmessagehandler/605>\
**Category:** JavaScript\
**Created:** [July 9, 2020, 1:25pm UTC](https://community.sendbird.com/t/push-notifications-setbackgroundmessagehandler/605 "2020-07-09T13:25:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![emmad](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/emmad/32/345_2.png) [@emmad](https://community.sendbird.com/u/emmad)\
**Post date:** [July 9, 2020, 1:25pm UTC](https://community.sendbird.com/t/push-notifications-setbackgroundmessagehandler/605/1 "2020-07-09T13:25:13Z")

</div>

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](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):

 ![image](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/1X/b160fb2c5d05f7c50b38758accce3eb66de7e76a.png)

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](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/1X/1e21a4e3d5e50f8becc168f048424cdb89b1f474.png)

![image](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/1X/d328df6d50f76817d17f2e0c0bbc71666ed9e2b7.png)

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

---

<div class="post-metadata">

**Author:** ![Woo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/woo/32/125_2.png) [@Woo](https://community.sendbird.com/u/Woo)\
**Post date:** [July 10, 2020, 5:57pm UTC](https://community.sendbird.com/t/push-notifications-setbackgroundmessagehandler/605/2 "2020-07-10T17:57:08Z")

</div>

Hi @emmad Are you getting right type of token at step 1? [https://rnfirebase.io/reference/messaging#getAPNSToken](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

---

<div class="post-metadata">

**Author:** ![emmad](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/emmad/32/345_2.png) [@emmad](https://community.sendbird.com/u/emmad)\
**Post date:** [July 19, 2020, 10:23pm UTC](https://community.sendbird.com/t/push-notifications-setbackgroundmessagehandler/605/3 "2020-07-19T22:23:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Woo](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/woo/32/125_2.png) [@Woo](https://community.sendbird.com/u/Woo)\
**Post date:** [July 20, 2020, 8:33pm UTC](https://community.sendbird.com/t/push-notifications-setbackgroundmessagehandler/605/4 "2020-07-20T20:33:21Z")

</div>

@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/](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)

---

<div class="post-metadata">

**Author:** ![emmad](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/emmad/32/345_2.png) [@emmad](https://community.sendbird.com/u/emmad)\
**Post date:** [July 24, 2020, 12:45pm UTC](https://community.sendbird.com/t/push-notifications-setbackgroundmessagehandler/605/5 "2020-07-24T12:45:43Z")

</div>

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
