Firebase X
This plugin brings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project! Android and iOS supported. It is a maintained fork from unmaintained ionic-navite plugin called Firebase.
https://github.com/dpa99c/cordova-plugin-firebasex
Stuck on a Cordova issue?
If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.
Installation
- Capacitor
- Cordova
- Enterprise
$ npm install cordova-plugin-firebasex
$ npm install @awesome-cordova-plugins/firebase-x
$ ionic cap sync
$ ionic cordova plugin add cordova-plugin-firebasex
$ npm install @awesome-cordova-plugins/firebase-x
Ionic Enterprise comes with fully supported and maintained plugins from the Ionic Team. Learn More or if you're interested in an enterprise version of this plugin Contact Us
Supported Platforms
- Android
- iOS
Usage
React
Learn more about using Ionic Native components in React
Angular
import { FirebaseX } from '@awesome-cordova-plugins/firebase-x/ngx';
constructor(private firebaseX: FirebaseX) { }
...
this.firebaseX.getToken()
.then(token => console.log(`The token is ${token}`)) // save the token server-side and use it to push notifications to this device
.catch(error => console.error('Error getting token', error));
this.firebaseX.onMessageReceived()
.subscribe(data => console.log(`User opened a notification ${data}`));
this.firebaseX.onTokenRefresh()
.subscribe((token: string) => console.log(`Got a new token ${token}`));