Push Notifications - Firebase (Advanced)
Last updated
Was this helpful?
Last updated
Was this helpful?
We are using Service to provide a Push Notification functionality.
On initialization, the element will try to get the current notification permission status. (No need to call it on the Page Is Load event)
Firebase FMC Token Updated - get called when was updated.
Firebase APNS Token Updated - get called when was updated.
Notification permissions authorized - get called when the user clicks Allow on permission alert.
Notification permissions denied - get called when the user clicks Decline on permission alert.
Notification permissions status updated - get called when permission status was updated because of the user's action.
Topic subscription status - get called when topic subscription status was updated because of the user's action: subscribe/unsubscribe.
Permission Status - Yes or No.
Topic subscription status - 'SUCCESS' if the 'subscribe' action was successful
Topic unsubscribe status - 'SUCCESS' if the 'unsubscribe' action was successful
Request the user's push notification permission - displays a systems popup with your Notification Permissions Text
Get the user's Firebase APNS Token - Reload the user's Firebase APNS token
Get the user's Firebase FCM Token - Reload the user's Firebase FCM token
Get the user's push notification permission status
Subscribe to topic
Unsubscribe from topic
Cloud Messaging REST API
To a topic subscribers
To a single user
Request Push Notification permission whenever you need it.
Save APNS token to your user model (only for iOS)
Save FCM token to your user model
How to set up?
call firebase_request_permission (required for both iOS & Android).
call firebase_get_apns_token (will return the APNS token for iOS).
call firebase_get_token (will return the FCM token).
Save FMC token and the APNS token (for iOS) somewhere (for example, save them in the user's fcm_token property and apns_token property).
Request the user's notification permission. You can do that in any necessary place. For example: show a popup that explains to the user's why your app needs it (so, it can be a better experience when just displaying a system popup)
Identify a user by using FCM token.
Firebase FCM Token - 's text value.
Firebase APNS Token - 's text value
Topic ID - the name
Topic ID - the name
Firebase Console -
Topic messaging -
Make sure you've your app and Firebase for Push Notifications.
Check the fcm_token value on each login (It can be )