Skip to content

Firebase Cloud Messaging

Non-Visible component
Category Requires Version
Google API 21, Android 5.0 Lollipop 1

Overview

A non-visible component for receiving push notifications, managing device tokens, and subscribing to topics using Firebase Cloud Messaging (FCM). Requires a google-services.json file configured in your Firebase project.

Permissions

Events

Error Occurred

Fired when an error occurs during token retrieval, topic subscription, or Firebase initialization.

Params
message Text

Message Received

Fired when a message is received from FCM, whether the app is in the foreground or background.

Params
message ID Text
from Text
title Text
body Text
data Dictionary
sent Time Number
ttl Number
priority Number
collapseKey Text
image URL Text

Notification Clicked

Fired when the user taps a notification. Provides the message data that was included in the notification.

Params
message ID Text
title Text
body Text
data Dictionary
image URL Text

Notification Permission State Changed

Called when the user accepts or declines the permission prompt, or enables or disables notifications for your app in the device's app settings and then returns to your app.

Params
granted Boolean

Token Received

Fired with the current FCM registration token. Triggered by a GetToken call, and also when the token is rotated (fresh install, app data cleared, or security event). Send this token to your server to target this device for push notifications.

Params
token Text

Methods

Are Notification Enabled

Returns: Boolean

Returns true if the user has enabled notifications for this app, false otherwise. On Android 13+ this also reflects the POST_NOTIFICATIONS permission.

Get Token

Requests the current FCM registration token. The token is delivered asynchronously via the TokenReceived event. The token uniquely identifies this app instance for push notifications.

Request Notification Permission

Shows the native system prompt asking the user for push notification permission. Required on Android 13+ to display notifications. Fires NotificationPermissionStateChanged with the result. On older Android versions where the permission is auto-granted at install time, the event reflects whether notifications are enabled in the device's app settings.

Subscribe To Topic

Subscribes to an FCM topic. Messages sent to this topic will be received by this device. Topic names must match the pattern [a-zA-Z0-9-_.~%]+.

Params
topic Text

Unsubscribe From Topic

Unsubscribes from an FCM topic.

Params
topic Text

Properties

Show Notification In Foreground

Boolean Default: True ➖ Read Write - Designer Blocks

When true, a system notification is automatically displayed for messages received while the app is in the foreground. The MessageReceived event fires regardless of this setting.