I watched the steps exactly but I get an error.
app.component.ts
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { HomePage } from '../pages/home/home';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = HomePage;
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
platform.ready().then(() => {
statusBar.styleDefault();
splashScreen.hide();
window.FirebasePlugin.getToken(function(token) {
// save this server-side and use it to push notifications to this device
console.log(token);
}, function(error) {
console.error(error);
});
Window.FirebasePlugin.onNotificationOpen(function(notification) {
console.log(notification);
}, function(error) {
console.error(error);
});
});
}
}
`
do not use capital W
even without the capital, the error persist
Same here, was this solved?
I solved using another plugin : cordova-plugin-fcm
Caused by using TypeScript with out the proper types. You can get around this by doing:
const plugin = (<any>window).FirebasePlugin;
// or
const plugin = (window as any).FirebasePlugin;
I solved using another plugin : cordova-plugin-fcm
FCM breaks on Android 7.1.1 for Ionic. @rwoody solution works.
Most helpful comment
Caused by using TypeScript with out the proper types. You can get around this by doing: