4.1.2 • Published 4 years ago

cordova-plugin-firebase-lib-cares v4.1.2

Weekly downloads
4
License
MIT
Repository
-
Last release
4 years ago

Cordova Firebase Plugin2

npm version

This plugin brings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project!

Table of Contents

4.0.0 - Breaking Change

Minimum v8.0.0 of cordova-android is now required. View https://github.com/wizpanda/cordova-plugin-firebase-lib/pull/13 for details.

Difference from the fork repository

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. To see a full list of changes done after we started maintaining this fork, please see the Releases(https://github .com/wizpanda/cordova-plugin-firebase-lib/releases) or read the CHANGELOG.md

Installation

Uninstall the original firebase plugin

If you are using the original firebase plugin, remove it first:

rm -rf platforms/android
cordova plugin remove cordova-plugin-firebase

For cordova-android >= 8.x.x

Since v4.0.0, this plugin no longer support cordova-android 7.x.x because of the breaking change released by Google on Jun 17, 2019. See https://github.com/wizpanda/cordova-plugin-firebase-lib/pull/13

To install the latest version, run the following in your terminal:

cordova plugin add cordova-plugin-firebase-lib --save

For cordova-android <= 7.1.4

Run the following in your terminal:

cordova plugin add cordova-plugin-firebase-lib@3.3.0 --save

Or add the following in your config.xml:

<plugin name="cordova-plugin-firebase-lib" spec="^3.3.0" />

AndroidX

Because of the major breaking release by Google Firebase on Jun 17, 2019 this plugin has been migrated to use AndroidX. AndroidX is a major improvement to the original Android Support Library.

If any of your Cordova app includes any plugin which is still using legacy Android Support Library, then installing this plugin might break your build. For that install the following plugins:

cordova plugin add cordova-plugin-androidx
cordova plugin add cordova-plugin-androidx-adapter

Supported Cordova Versions

  • cordova: >= 8
  • cordova-android: >= 8.0.0
  • cordova-ios: >= 4.5.5

Guides

  1. Great installation and setup guide https://medium.com/@felipepucinelli/how-to-add-push...

Setup

Download your Firebase configuration files:

  • GoogleService-Info.plist for iOS and
  • google-services.json for Android

And place them in the root folder of your cordova project. Check out this firebase article for details on how to download the files.

- my-cordova-project/
    platforms/
    plugins/
    www/
    config.xml
    google-services.json       <--
    GoogleService-Info.plist   <--
    ...
IMPORTANT NOTES
  • 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 and platforms/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.

PhoneGap Build

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.

Google Play Services

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.

Docs

API

See the full API docs available for this plugin.

Google Tag Manager

Checkout our guide for info on setting up Google Tag Manager.

Configuring Notifications

Checkout our guide for info on configuring notification icons and colors.