Miscellaneous
Triggering and Responding to Push Notifications
Start a push notifications service
To start the push notifications service all you need are the following details, which you can retrieve from the Project settings page in the Firebase Console:
projectID
- The project ID in "Your project" of "General" tab in Firebase project settingsapiKey
- The Web API key in "Your project" of "General" tab in Firebase project settingsappID
- The app ID in in "Your apps" of "General" tab in Firebase project settingsvapidKey
- The public key pair in "Web configuration" of "Cloud Messaging" tab in Firebase project settings. You will need to click "Generate key pair" if the key pair is not already generated.
With these details you can start the push notifications service by calling the start
method and passing in the options outlined above.
If you have ever created an application before ToDesktop Builder v0.23.1
then you should check the supportsNewFCMService()
method returns true
before starting the push notifications service. This will ensure that you don't get a runtime error with older applications.
Support legacy applications
You can also choose to support the legacy push notifications service which only required a senderID
.
Respond to push notification "start" events
Triggered when the push notifications service is started successfully and an FCM registration token has been received.
Respond to push notification "receive" events
Triggered when a push notifications service is received.
Respond to push notification "error" events
Triggered when the push notifications service is started successfully and an FCM registration token has been received.
Respond to push notification "tokenUpdate" events
Triggered when the FCM registration token has been updated.