Firebase-Cloud-Messaging-for-WebPush.md (3830B)
Firebase Cloud Messaging for WebPush
Testing
If you want to test WebPush support for features like Send Tab or WebPush for web apps, then you need to follow the instructions below to enable this for your debug application:
- With the "Play" button you can always reset your emulator to that state and repeat the migration pro0
- With the "Play" button you can always reset your emulator to that state and repeat the migration pro0
* This will be compiled into the debug variant.
- With the "Play" button you can always reset your emulator to that state and repeat the migration pro0
`
Received a new registration token from push service.
Got new Firebase token.
`
Components and code
The important components for push to work are the feature-push (specifically look at the README) and lib-push-firebase.
For GeckoView, look at `WebPushEngineIntegration.kt` that connects the AutoPushFeature from feature-push to the Engine.
For Firefox Sync, it's the `feature-accounts-push`.
Firefox Sync & Send Tab
If you are testing WebPush support with Firefox Sync, you should also expect to see this log shortly after signing into a Firefox Sync account:
Created a new subscription: [context data]
FAQ
Q. Why are credentials stored in Google Drive?
* Firebase services require a credential file, typically named google-services.json, which are retrieved from the Firebase console for all the applications in that project. Our requirements are somewhat unique, so we generate our own XML file from google-services.json and use that.
According to Firebase engineers, it should be safe to commit our google-services.json but we avoid doing that as there are other forks of Fenix that must not use these credentials.
For example, the Google I/O app commits their release version of the file to Github as well.
Q. What are the special requirements which mean we can't directly use `google-services.json`?
* Following the 'Getting Started' Firebase instructions to initialize the service in Fenix would not work as we explicitly chose not to use the com.google.gms.google-services Gradle plugin as the Android service would be initialized with a `ContentProvider` eagerly which reduces our control on how the application can start up in a performant way since the Browser startup sequence is quite unique.
Q. Where do we get the `google-services.json` file from?
* Ask your friendly Release Management teammate if they can access the Cloud Messaging console at console.firebase.google.com.
Q. How do I generate the XML file from `google-services.json`?
* The easiest way is to use this clever web app that does this for you.
* The more official and tedious way, would be to do this manually by following the instructions on the google services plugin site.
* Note that the google-services.json file may have the credentials for multiple applications, so ensure you are copying the instructions for the correct project.