Search docs/
Getting StartedPlugins

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.

Contact Us Today!

Installation

npm install cordova-plugin-firebasexnpm install @ionic-native/firebase-xionic cap syncionic cordova plugin add cordova-plugin-firebasexnpm install @ionic-native/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

See here.

Angular

import { FirebaseX } from '@ionic-native/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}`));