Add Firebase plugin
Currently using this one
https://github.com/arnesson/cordova-plugin-firebase
cordova plugin add https://github.com/arnesson/cordova-plugin-firebase
Set up project in firebase
- Download google services plist (put it in the root of phonegap, then cordova prepare)
- Set up APNs
https://console.firebase.google.com/u/0/project/vet2vet/settings/cloudmessaging
create the APNs auth key
- reuse key from another project (same development team)
- copy the key ID and team ID from the other project to your clipboard
- locate the key file and re-upload the key file to firebase (the key file is on MacBain, or you can re-download it from Itunes connect)
Get server key
- copy the server key into Web_AppSettings.config for the backend code to send the push notifications
Xcode setup
In Xcode, under Capabilities tab in the project, select:
- Push Notifications
- Background Modes: notifications
How to test the notifications
1. test firebase is connected properly by running the firebase online wizard for getting set up
2. check that devices are getting push tokens registered (which we save in our backend database under PushToken)
3. go to Grow > Cloud Messaging to send notifications
- send a live notification to all users using the "all" topic, which we have set up as a default subscription in our default implementation
- send a test a notification to a single device by grabbing the push token, which you can find in our backend database
Leave a Comment
Comments