This plugin brings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project!
Maintained by Wiz Panda.
The author did a great job on the plugin. But seems not to be maintaining the changes. So we at Wiz Panda thought to maintain the repository with the latest changes & fixes so the others can take benefit of the Firebase in their cordova application.
Here are the following changes in the first version i.e. 3.0.0
- Cordova@9 support
- Fixes issues cause by Firebase SDK updates on 5 April 2019. Thanks to Dave Alden for commit
- Remove obsolete entry for FirebasePluginInstanceIDService. Thanks to Dave Alden for commit
- Remove unnecessary extra block which can lead to race condition. Thanks to Dave Alden for commit
- Remove redundant build-extras.gradle. Thanks to Dave Alden for commit
For the changes on the next versions, please check the CHANGELOG.md
- cordova:
>= 7
- cordova-android:
>= 7.0.0
- cordova-ios:
>= 4.5.5
Install the plugin by adding it to your project's config.xml
:
<plugin name="cordova-plugin-firebase-lib" spec="^3.0.0" />
or by running:
cordova plugin add cordova-plugin-firebase-lib --save
- Great installation and setup guide https://medium.com/@felipepucinelli/how-to-add-push...
Download your Firebase configuration files:
GoogleService-Info.plist
for iOS andgoogle-services.json
for Android
And place them in the root folder of your cordova project. Check out this [firebase article](https://support.google .com/firebase/answer/7015592) for details on how to download the files.
- my-cordova-project/
platforms/
plugins/
www/
config.xml
google-services.json <--
GoogleService-Info.plist <--
...
- This plugin uses a hook (after prepare) that copies the configuration files to the right place, namely
platforms/ios/my-cordova-project/Resources
for iOS andplatforms/android
for Android. - Firebase SDK requires the configuration files to be present and valid, otherwise your app will crash on boot or Firebase features won't work.
Hooks do not work with PhoneGap Build. This means you will have to manually make sure the configuration files are included. One way to do that is to make a private fork of this plugin and replace the placeholder config files (see src/ios
and src/android
) with your actual ones, as well as hard coding your app id and api key in plugin.xml
.
If you are using cordova-cli@9
(i.e. cordova-lib@9
) then you might need to install the xcode
npm module dependency separately. To
do that, just run this command npm i xcode --save-dev
in your app.
Your build may fail if you are installing multiple plugins that use Google Play Services. This is caused by the plugins installing different versions of the Google Play Services library. This can be resolved by installing cordova-android-play-services-gradle-release.
If your build is still failing, you can try installing cordova-android-firebase-gradle-release. For more info, read the following comment about locking down the specific versions for play services and firebase. It is suggested to use +
instead of 15.+
to ensure the correct versions are used.
Checkout our guide for info on setting up Google Tag Manager.
Checkout our guide for info on configuring notification icons and colors.
See the full API available for this plugin.