Navigation

Send Mobile Push Notifications

You can send native push notifications to mobile client applications using the Push Notification Service.

The Push Notifications screen in the Realm UI lets you write notification drafts, send notifications to users and define notification rules.

There are four tabs in the Push Notifications screen:

Tab NameDescription
Draft

In the Draft tab, you can view a list of the draft messages. For the draft messages, you can:

  • Duplicate draft messages
  • Edit draft messages
  • Delete draft messages
Sent

The Sent tab shows the messages that MongoDB Realm has already sent to registered clients. From here, you can view a list of the sent messages. For the sent messages, you can:

  • Resend sent messages.
  • Duplicate sent messages.
ConfigIn the Config tab, you provide the FCM credentials (Sender ID and Legacy API key).
RulesYou can optionally specify Push Notification Rules to restrict the types of push notifications that your application sends.

You can send new Push Notifications from the Push Notifications page. Click the Send New Notification button to open the Send New Notification dialog. In this dialog, you provide the notification message, label, and the relevant topic audience.

Sending a new Push Notification

The general process of integrating Push Notifications in an Android application is as follows:

  1. Add a dependency for FCM .
  2. Create an instance of Push.
  3. Use the push.registerDevice() or push.registerDeviceAsync() methods to register the client for push notifications.
  4. Use FirebaseMessaging's subscribeToTopic() to subscribe to topics.
  5. Create a class that extends the abstract FirebaseMessagingService and implements the onMessageReceived() method. This class handles communication with FCM .
  6. Update AndroidManifest.xml file for your Android project to register your FirebaseMessagingService-derived class and a receiver for your application.

To see the latest information and detailed steps on FCM integration with Android Clients, see the official Set up a Firebase Cloud Messaging client app on Android guide.

Give Feedback