A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://firebase.google.com/docs/reference/android/com/google/firebase/messaging/FirebaseMessaging below:

FirebaseMessaging | Firebase SDKs for Android

Stay organized with collections Save and categorize content based on your preferences.

FirebaseMessaging
public class FirebaseMessaging

Top level Firebase Cloud Messaging singleton that provides methods for generating tokens and subscribing to topics.

In order to receive 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.

Summary Constants INSTANCE_ID_SCOPE
public static final String INSTANCE_ID_SCOPE = "FCM"
This field is deprecated.

Use getToken instead

Specifies scope used in obtaining a registration token when calling FirebaseInstanceId.getToken()

Public methods deleteToken
public @NonNull Task<VoiddeleteToken()

Deletes the FCM registration token for this Firebase project.

Note that if auto-init is enabled, a new token will be generated the next time the app is started. Disable auto-init (setAutoInitEnabled) to avoid this.

Note that this does not delete the Firebase Installations ID that may have been created when generating the token. See FirebaseInstallations.delete() for deleting that.

deliveryMetricsExportToBigQueryEnabled
public boolean deliveryMetricsExportToBigQueryEnabled()

Determines whether Firebase Cloud Messaging exports message delivery metrics to BigQuery.

Returns boolean

true if Firebase Cloud Messaging exports message delivery metrics to BigQuery.

getToken
public @NonNull Task<StringgetToken()

Returns the FCM registration token for this Firebase project.

This creates a Firebase Installations ID, if one does not exist, and sends information about the application and the device where it's running to the Firebase backend. See deleteToken for information on deleting the token and the Firebase Installations ID.

isAutoInitEnabled
public boolean isAutoInitEnabled()

Determines whether FCM auto-initialization is enabled or disabled.

Returns boolean

true if auto-init is enabled and false if auto-init is disabled

isNotificationDelegationEnabled
public boolean isNotificationDelegationEnabled()

Returns whether notification delegation is enabled or not.

Returns boolean

true if enabled, false otherwise.

send
public void send(@NonNull RemoteMessage message)
This method is deprecated.

This function is actually decommissioned along with all of FCM upstream messaging. Learn more in the FAQ about FCM features deprecated in June 2023.

Sends message upstream to your app server.

When there is an active connection the message will be sent immediately, otherwise the message will be queued up to the time to live (TTL) set in the message.

setAutoInitEnabled
public void setAutoInitEnabled(boolean enable)

Enables or disables auto-initialization of Firebase Cloud Messaging.

When enabled, Firebase Cloud Messaging generates a registration token on app startup if there is no valid one (see getToken) and periodically sends data to the Firebase backend to validate the token. This setting is persisted across app restarts and overrides the setting specified in your manifest.

By default, Firebase Cloud Messaging auto-initialization is enabled. If you need to change the default, (for example, because you want to prompt the user before Firebase Cloud Messaging generates/refreshes a registration token on app startup), add to your application’s manifest:

<meta-data android:name="firebase_messaging_auto_init_enabled" android:value="false" />
Parameters boolean enable

Whether Firebase Cloud Messaging should auto-initialize.

setDeliveryMetricsExportToBigQuery
public void setDeliveryMetricsExportToBigQuery(boolean enable)

Enables or disables Firebase Cloud Messaging message delivery metrics export to BigQuery.

By default, message delivery metrics are not exported to BigQuery. Use this method to enable or disable the export at runtime. In addition, you can enable the export by adding to your manifest. Note that the run-time method call will override the manifest value.

<meta-data android:name= "delivery_metrics_exported_to_big_query_enabled"
android:value="true"/>
Parameters boolean enable

Whether Firebase Cloud Messaging should export message delivery metrics to BigQuery.

setNotificationDelegationEnabled
public @NonNull Task<VoidsetNotificationDelegationEnabled(boolean enable)

Sets notification delegation to enabled or disabled.

By default, notification delegation is enabled. You can also the following manifest entry to disable notification delegation:

<meta-data android:name="firebase_messaging_notification_delegation_enabled"
android:value="false"/>

Setting notification delegation using this method will override any value set in the manifest.

Notification delegation is supported from Android Q and above. See setNotificationDelegate

Parameters boolean enable

Whether to enable or disable notification delegation.

Returns @NonNull Task<Void>

A Task that completes when the notification delegation has been set.

subscribeToTopic
public @NonNull Task<VoidsubscribeToTopic(@NonNull String topic)

Subscribes to topic in the background.

The subscribe operation is persisted and will be retried until successful.

This uses an FCM registration token to identify the app instance, generating one if it does not exist (see getToken), which periodically sends data to the Firebase backend when auto-init is enabled. To delete the data, delete the token (deleteToken) and the Firebase Installations ID (FirebaseInstallations.delete()). To stop the periodic sending of data, disable auto-init (setAutoInitEnabled).

Parameters @NonNull String topic

The name of the topic to subscribe. Must match the following regular expression: "[a-zA-Z0-9-_.~%]{1,900}".

Returns @NonNull Task<Void>

A task that will be completed when the topic has been successfully subscribed to.

unsubscribeFromTopic
public @NonNull Task<VoidunsubscribeFromTopic(@NonNull String topic)

Unsubscribes from topic in the background.

The unsubscribe operation is persisted and will be retried until successful.

Parameters @NonNull String topic

The name of the topic to unsubscribe from. Must match the following regular expression: "[a-zA-Z0-9-_.~%]{1,900}".

Returns @NonNull Task<Void>

A task that will be completed when the topic has been successfully unsubscribed from.

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.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-21 UTC."],[],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4