FCM Notification Flow
To broadcast a global level notification to all/specified users for providing set of information based upon the sunbird platform.
Registering the device to Notification server
Registering device for receiving the notification broadcast from notification server.
Install the app and launch application
Generate the notification token and send it to the notification server
send user language to the notification server
store notification token locally
Cordova Plugin
Google FCM Push Notifications Cordova Plugin
Refer plugin Doc for installation
Link: https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated
Ionic Link: https://ionicframework.com/docs/native/fcm
Payload Data for sending Notifications
{
notification: {
title: "notification titile",
body: "Message description body",
sound: "sound_path/file_name.mp3",
click_action: "FCM_PLUGIN_ACTIVITY",
icon: "icon_path/icon.png"
},
data: {
type: 2 , //Notification type will be integer - Their can different notification types, like DOWNTIME, GREETINGS, NON-DISPLAY and OTHERS
bannerIcon: , //
actionLink: {
updateApp: , // Play Store link
courseID: , // Course registered/started
contentID: , // Try new content
bookID: , // Book updated
updatedFAQ: , // FAQ page(+section ID)
survey: , // Google Form link (EXTERNAL URL)
extVideo: , // Informational video - YouTube link (EXTERNAL URL)
}
}
}
Localization
Storing data locally for app purpose uses.
Notification data - For in-app display of received notifications for user
Notification Token - Token expiry check and updating token if expired