Firebase Cloud Messagingplat_iosplat_androidplat_web

Firebase Cloud Messaging (FCM) is a cross-platform messaging solution that lets you reliably deliver messages and notifications at no cost.

Using FCM, you can notify a client app that new email or other data is available to sync. You can send notifications to drive user reengagement and retention. For use cases such as instant messaging, a message can transfer a payload of up to 4KB to a client app.

Already using Google Cloud Messaging? Learn more about your options.

iOS SETUP Android Setup Web Setup

Key functions

Versatile message targeting Distribute messages to your client app in any of three ways — to single devices, to groups of devices, or to devices subscribed to topics.
Data message and notifications support Deliver notifications up to 2KB, data payloads up to 4KB, and send messages with both notification and data payload.
Upstream messaging from client apps Send acknowledgments, chats, and other messages from devices back to your server over FCM’s reliable and battery-efficient connection channel.

How does it work?

Firebase Cloud Messaging architecture diagram

An FCM implementation includes an app server in your environment that interacts with FCM via HTTP or XMPP protocol, and a client app. Additionally, FCM includes the Notifications console, which you can use to send notifications to client apps.

Firebase Notifications is built on Firebase Cloud Messaging and shares the same FCM SDK for client development. For testing or for sending marketing or engagement messages with powerful built-in targeting and analytics, you can use Notifications. For deployments with more complex messaging requirements, FCM is the right choice.

Implementation path

Set up the FCM SDK Set up Firebase and FCM on your app according the setup instructions for your platform.
Develop your client app Add message handling, topic subscription logic, or other optional features to your client app. During the development, you can easily send test messages from the Notifications console.
Develop your app server Decide which server protocol(s) you want to use to interact with FCM, and add logic to authenticate, build send requests, handle response, and so on. Note that if you want to use upstream messaging from your client applications, you must use XMPP.

Next steps

  • Run the Android or iOS Quickstart sample. These samples let you run and review code to send a test message to a single device using the Notifications console.

  • Add Firebase Cloud Messaging to your Android, iOS, or Web app.

  • Set up your server. To see a working example, start by reviewing the Firebase Cloud Messaging Playground app available on GitHub. Get help with server development using the server setup guide, guides to sending messages with your app server, and the complete references for HTTP and XMPP.

  • Learn more about sending data payloads, setting message priority, and other advanced messaging options that are available with FCM.

  • Migrate your existing Android or iOS GCM implementation to use Firebase Cloud Messaging.

Send feedback about...