window.FirebasePlugin undefined (Property 'FirebasePlugin' does not exist on type 'Window')


#1

I am developing a push notification application. https://www.npmjs.com/package/cordova-plugin-firebase.I followed the steps on this link.
But I get an undefined error.Where do i make mistakes.

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(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      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);
});
     

      
    });
 
  }
}



#2

You should follow the documentation from the native documentation for this plugin for ionic 2/3


#3

This plugin in beta. I used FCM plugin before.Worked and notifications came.My main goal is to be able to direct a request to a page by clicking on the notification.But i failed.Like social media (Facebook,Instagram)applications. Go to the page that I want when the user clicks the notification.Do you have any information on this

SAMPLE FCM PLUGÄ°N

app.component.ts

import { Component,ViewChild } from '@angular/core';
import { Platform,NavController,AlertController } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { FCM } from '@ionic-native/fcm';


import { HomePage } from '../pages/home/home';
import {PushPage} from '../pages/push/push';
declare var FCMPlugin;
@Component({
templateUrl: 'app.html',
providers :[FCM]

})
export class MyApp {
 rootPage:any = HomePage;
 @ViewChild(NavController) nav;

constructor(platform: Platform, statusBar: StatusBar, splashScreen: 
 SplashScreen,private fcm: FCM,
 private alertCtrl: AlertController) {
   platform.ready().then(() => {
   statusBar.styleDefault();
   splashScreen.hide();

   fcm.subscribeToTopic('marketing');
   fcm.getToken().then(token=>{

  })

   fcm.onNotification().subscribe(data=>{
    if(data.wasTapped){
     console.log("Received in background");
     this.nav.push(PushPage); 
   } else {
       console.log("Received in foreground");
       this.nav.push(PushPage);
   };
 })

  fcm.onTokenRefresh().subscribe(token=>{
    this.nav.push(PushPage);
 })
  fcm.unsubscribeFromTopic('marketing');

   });

 }

}

I try different add-ons for him