IMPORTANT: In July 2025, we stopped releasing new versions of KTX modules, and we removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the previously released KTX modules, we recommend that you
migrate your app to use KTX APIs from the main modules instead. For details, see the
FAQ about this initiative.
Stay organized with collections
Save and categorize content based on your preferences.
com.google.firebase.messaging
Contains public API classes for Firebase Cloud Messaging.
Classes
Exceptions
Annotations
Top-level functions summary
Extension properties summary
Top-level functions
Extension properties
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-21 UTC.
[null,null,["Last updated 2025-07-21 UTC."],[],[],null,["# com.google.firebase.messaging\n=============================\n\nContains public API classes for Firebase Cloud Messaging.\n\nClasses\n-------\n\n|---------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [FirebaseMessaging](/docs/reference/kotlin/com/google/firebase/messaging/FirebaseMessaging) | Top level [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging/) singleton that provides methods for generating tokens and subscribing to topics. |\n| [FirebaseMessagingService](/docs/reference/kotlin/com/google/firebase/messaging/FirebaseMessagingService) | Base class for receiving messages from Firebase Cloud Messaging. |\n| [RemoteMessage](/docs/reference/kotlin/com/google/firebase/messaging/RemoteMessage) | A remote Firebase Message. |\n| [RemoteMessage.Builder](/docs/reference/kotlin/com/google/firebase/messaging/RemoteMessage.Builder) | Builder object for constructing [RemoteMessage](/docs/reference/kotlin/com/google/firebase/messaging/RemoteMessage) instances. |\n| [RemoteMessage.Notification](/docs/reference/kotlin/com/google/firebase/messaging/RemoteMessage.Notification) | Remote Firebase notification details. |\n\nExceptions\n----------\n\n|-------------------------------------------------------------------------------------|----------------------------------|\n| [SendException](/docs/reference/kotlin/com/google/firebase/messaging/SendException) | Firebase message send exception. |\n\nAnnotations\n-----------\n\n|---------------------------------------------------------------------------------------------------------------------|-------------------------|\n| [RemoteMessage.MessagePriority](/docs/reference/kotlin/com/google/firebase/messaging/RemoteMessage.MessagePriority) | Priority of the message |\n\nTop-level functions summary\n---------------------------\n\n|----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `inline `[RemoteMessage](/docs/reference/kotlin/com/google/firebase/messaging/RemoteMessage) | [remoteMessage](/docs/reference/kotlin/com/google/firebase/messaging/package-summary#remoteMessage(kotlin.String,kotlin.Function1))`(to: `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, crossinline init: `[RemoteMessage.Builder](/docs/reference/kotlin/com/google/firebase/messaging/RemoteMessage.Builder)`.() `-\u003e` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` Returns a [RemoteMessage](/docs/reference/kotlin/com/google/firebase/messaging/RemoteMessage) instance initialized using the [init](/docs/reference/kotlin/com/google/firebase/messaging/package-summary#remoteMessage(kotlin.String,kotlin.Function1)) function. |\n\nExtension properties summary\n----------------------------\n\n|---------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [FirebaseMessaging](/docs/reference/kotlin/com/google/firebase/messaging/FirebaseMessaging) | [Firebase](/docs/reference/kotlin/com/google/firebase/Firebase)`.`[messaging](/docs/reference/kotlin/com/google/firebase/messaging/package-summary#(com.google.firebase.Firebase).messaging()) Returns the [FirebaseMessaging](/docs/reference/kotlin/com/google/firebase/messaging/FirebaseMessaging) instance of the default [FirebaseApp](/docs/reference/kotlin/com/google/firebase/FirebaseApp). |\n\nTop-level functions\n-------------------\n\n### remoteMessage\n\n```\ninline fun remoteMessage(to: String, crossinline init: RemoteMessage.Builder.() -\u003e Unit): RemoteMessage\n```\n\nReturns a [RemoteMessage](/docs/reference/kotlin/com/google/firebase/messaging/RemoteMessage) instance initialized using the [init](/docs/reference/kotlin/com/google/firebase/messaging/package-summary#remoteMessage(kotlin.String,kotlin.Function1)) function.\n\nExtension properties\n--------------------\n\n### messaging\n\n```\nval Firebase.messaging: FirebaseMessaging\n```\n\nReturns the [FirebaseMessaging](/docs/reference/kotlin/com/google/firebase/messaging/FirebaseMessaging) instance of the default [FirebaseApp](/docs/reference/kotlin/com/google/firebase/FirebaseApp)."]]