1.Introduction
Description: Using this extension you can receive Push Notifications with FCM's latest SDK (24.0.0).
Latest Version: 2
Released: 2023-10-29T18:30:00Z
Last Updated: 2024-06-17T18:30:00Z
Aix size: 480 kB
2. Blocks
3. Docs
Events
GotPermissionResult | Event raised after user grants/denies Notification permissionisGranted | boolean |
MessageReceived | Event raised when message is received. No notification is shown for messages.data | dictionary |
NotificationReceived | Event raised when notification is received while app is in foreground. A notification is shown to user in system tray.id | text title | text body | text data | dictionary |
SubscribeSuccessful | E ivent raised if subscribe was successfultopic | text |
UnsubscribeSuccessful | Event raised if unsubscribe was successfultopic | text |
ErrorOccurred | Event raised whenever an error occurrs. Most of the methods raise this event in case of error.method | text errorMsg | text |
GotToken | Event raised after getting FCM tokentoken | text |
GotData | Event raised when current screen has been opened by clicking notification. This event is raised automatically.data | dictionary |
Methods
AskNotificationPermission | Asks notification permission which is required on Android 13 and above |
IsPermissionGranted | Return whether user has granted Notification permission or not |
ClearNotification | Clear notification from system trayid | number |
Init | Initialize Firebase Messaging Client with provided credentials. You need to call this method only once and then extension will auto init client itself.projectId | text apiKey | text appId | text senderId | text |
IsInitialized | Returns whether FCM has been initialized or not |
Subscribe | Subscribe to given topic to receive notificationstopic | text |
RegisterForNotifClick | Registers screen which will be opened when user clicks on notification which is shown while app is in foreground. Notifications which are shown when app is not opened, will always open Screen1.screen | text startValue | text |
RetrieveData | Retrieves content of notification which opened/resumed current screen.Response is Dictionary. |
RetrieveBgMessages | Retrieve dictionary of messages which were received when app was not running. |
ClearBgMessages | Clear stored background messages. |
Unsubscribe | Unsubscribe from the given topictopic | text |
GetToken | Gets user's FCM token which can be used to send individual notifications |
Properties
Importance | Sets importance of notification channel Property Type : write-only Accepts : text |
SmallIcon | Sets small icon shown in notification. If not specified then app's icon is shown. Property Type : write-only Accepts : text |
4. Usages
First initialize FCM Client. You need to call Init method once and next time it would be auto initialized.
Ask for notification permission
Required on Android 13 and above
Now subscribe to a topic
If subscription was successful then you can send a notification/message to users who have subscribed to topic
Use FcmSender extension for sending notifications and messages
User receives notifications and clicks on it
There can be two scenarios here:-
- App in foreground ie. being used by user
Notification will open registered screen.
GotData
even will be raised upon screen initialization if screen opened through notification.
You can obtain data from
RetrieveData
method also.
- App not opened by user.
Notification click will open registered screen (or Screen1 if not set) andGotData
event will be raised. If no screen is registered then Screen where FCM extension has been initialized is automatically registered.
Retrieve all received messages
Old method
New method
5. Purchase
6. Demo
7. Updates
ChangeLog Version 1.1
ChangeLog Version 1.2
ChangeLog Version 1.3
ChangeLog Version 1.4
ChangeLog Version 2
Thank you.
Hope it helps!