Firebase
This plugin brings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project! Android and iOS supported (including iOS 10).
https://github.com/arnesson/cordova-plugin-firebase
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-firebase
$ npm install @awesome-cordova-plugins/firebase
$ ionic cap sync
$ ionic cordova plugin add cordova-plugin-firebase
$ npm install @awesome-cordova-plugins/firebase
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
Capacitor
Not Compatible
Usage
React
Learn more about using Ionic Native components in React
Angular
import { Firebase } from '@awesome-cordova-plugins/firebase/ngx';
constructor(private firebase: Firebase) { }
...
this.firebase.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.firebase.onNotificationOpen()
.subscribe(data => console.log(`User opened a notification ${data}`));
this.firebase.onTokenRefresh()
.subscribe((token: string) => console.log(`Got a new token ${token}`));