Set and manage message priority

You have two options for assigning delivery priority to downstream messages on Android: normal and high priority. Delivery of normal and high priority messages works like this:

  • Normal priority. This is the default priority for data messages. Normal priority messages are delivered immediately when the device is not sleeping. When the device is in Doze mode, delivery may be delayed to conserve battery until the device exits doze. For less time-sensitive messages, such as notifications of new email, keeping your UI in sync, or syncing app data in the background, choose normal delivery priority.

    When receiving a normal priority message on Android that requests a background data sync for your app, you can schedule a task with WorkManager to handle it when the network is available.

  • High priority. FCM attempts to deliver high priority messages immediately, allowing FCM to wake a sleeping device when necessary and to run some limited processing (including very limited network access). High priority messages generally should result in user interaction with your app or its notifications.

Using high priority messages For Android

High priority messages on Android are meant for time sensitive, user visible content, and should result in user-facing notifications. If FCM detects a pattern in which messages do not result in user-facing notifications, your messages may be deprioritized to normal priority. FCM uses 7 days of message behavior when determining whether to deprioritize messages; it makes this determination independently for every instance of your application. If, in response to high priority messages, notifications are displayed in a way that is visible to the user, then your future high-priority messages will not be deprioritized. This applies whether the notification is displayed by the FCM SDK via a notification message, or a developer-generated notification via a data message.

Measuring message deprioritization on Android

  • Individual Messages. On delivery, you can determine whether an individual message was deprioritized or not by comparing its delivered priority, from getPriority(), with its original priority, from getOriginalPriority()

  • All Messages. The FCM Aggregate Delivery Data API can report what percentage of all your messages to Android are being deprioritized. Some messages may be omitted from the aggregate data reports, but overall they should give a global view of message deprioritization rates. See our article on aggregated delivery data for more information and sample code for querying the API; it can also be explored from the API explorer.