Push Notifications using realm (FCM)

Hello,
I’m trying to enable push notifications in a React Native App using Realm ‘Push Notifications’.

I created my project in Firebase and connected it to realm → works
I can send Notifications using the realm UI → works
I’m getting the notifications on my device → works

Now my issue is that I want to trigger notifications. Therefore I would need to access this service with a function.
Yes, I could use the firebase admin SDK but since realm has a connection to it already my question is if that is possible and if so how?

ps. I checked this documentation (push-notifications) but it doesn’t help me at all.

Thanks for any help or advice :slight_smile:

Regards,
Ebrima

3 Likes

Hello,

Same problem on iOS.

Thanks,
Andrei

1 Like

I did a bit of research and figured out that the third-party service you want to call is ‘gcm’ not ‘fcm’ as I expected.

This example works for me:

   // Construct message
  const message = {
    "to": "/topics/someTopic",
    "notification": {
      "title": "Message Title",
      "body": "Message Body",
    },
  };
  
  // Send push notification
  const gcm = context.services.get('gcm');
  const result = gcm.send(message);
  return result;
5 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.