java.lang.Object | |
↳ | com.google.firebase.messaging.FirebaseMessaging |
Firebase Cloud Messaging lets you reliably deliver messages at no cost.
Messages can be sent from the Firebase Notifications console, using a topic that has been
subscribed to via subscribeToTopic(String)
, or by getting a token for an app instance
via getToken()
.
In order to receive Firebase messages, declare an implementation of
FirebaseMessagingService
in the app manifest. To process messages, override base class
methods to handle any events required by the application.
Client apps can send upstream messages back to the app server using the XMPP-based Cloud Connection Server. For example:
FirebaseMessaging.getInstance().send( new RemoteMessage.Builder(SENDER_ID + "@gcm.googleapis.com") .setMessageId(id) .addData("key", "value") .build());
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | INSTANCE_ID_SCOPE | Specifies scope used in obtaining a registration token when calling
getToken()
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Subscribe to topic in background.
| |||||||||||
Unsubscribe from topic in background.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Specifies scope used in obtaining a registration token when calling
getToken()
Subscribe to topic in background.
Parameters | |
---|---|
topic |
String :
The name of the topic to subscribe.
Must match the following regular expression: "[a-zA-Z0-9-_.~%]{1,900}".
|
Unsubscribe from topic in background.
Parameters | |
---|---|
topic |
String :
The name of the topic to unsubscribe from.
Must match the following regular expression: "[a-zA-Z0-9-_.~%]{1,900}".
|