Cordova Error with angular

I faced a problem my event didn’t launch in my app and when I call function that have cordova plugin firebase show that error below Please advise
Here is my code :
import { Renderer2, Component, HostListener } from ‘@angular/core’;

import { Router, NavigationEnd } from ‘@angular/router’;

import { ServiceHandler } from ‘./injector/service-handler’;

import { LoginService } from ‘./injector/login.service’;

import { Iuser } from ‘./model/iuser’;

import { LanguageService } from ‘./injector/language.service’;

import {MatDialog} from ‘@angular/material/dialog’;

import { IDialog } from ‘./model/idialog’;

import {DeviceUUID} from ‘device-uuid’;

@Component({

selector: ‘app-root’,

templateUrl: ‘./app.component.html’,

styleUrls: [’./app.component.scss’]

})

export class AppComponent {

title = ‘rayatradecommunication’;

private previousUrl: string;

private currentUrl: string;

private loginuser: Iuser;

private objdialog : IDialog;

uuid = new DeviceUUID().get();

constructor(private router: Router,

private api: ServiceHandler,

private user: LoginService,

private lang: LanguageService,

private render: Renderer2,

public dialog: MatDialog,

    

) {

this.user.user$.subscribe(

  _user => this.loginuser = _user

)

this.currentUrl = this.router.url;

this.router.events.subscribe(event => {

  if (event instanceof NavigationEnd) {

    this.previousUrl = this.currentUrl;

    this.currentUrl = event.url;

  };

});



console.log("Ezzats");

console.log('DeviceID',this.uuid);

this.user.DeviceID = this.uuid;



this.lang.language$.subscribe(

  langu => {

    this.render.addClass(document.body, langu === 'En' ? 'ltr' : 'rtl');

    this.render.removeClass(document.body, langu === 'En' ? 'ltr' : 'rtl');

  }

);

}

@HostListener(“document:deviceready”, )

deviceReady() {

console.log('DeviceID',this.uuid);



this.user.DeviceID = this.uuid;

(window as any).cordova.plugins.firebase.messaging.onMessage((payload) => {

  console.log('Angular New foreground FCM message: ', payload);

  try {

    window.alert('You have a new notificaion');



  }

  catch (Exception) { console.log("error",Exception.message); }

});

(window as any).cordova.plugins.firebase.messaging.onBackgroundMessage((payload) => {

  console.log('Angular  New background FCM message: ', payload);

});



(window as any).cordova.plugins.firebase.messaging.requestPermission().then(() => {

  (window as any).cordova.plugins.firebase.messaging.getToken().then((token) => {

    console.log('Angular  Got device token: ', token);

    this.user.userToken = token;

    console.log('Token = :' + token);

   

  });

});

  return true;

}

@HostListener(‘window:popstate’, [’$event’])

onPopState(event) {

//alert(this.currentUrl +"---" + this.previousUrl);

//this.router.navigate(['./'+this.currentUrl]);

(window as any).navigator.Backbutton.goHome(function () {

  this.router.navigate(['./mainpage/News']);

}, function () {

});

(window as any).navigator.Backbutton.goBack(function () {

  this.router.navigate(['./mainpage/News']);

}, function () {

});

}

}

-That’s the error when I call function :
AppComponent_Host.ngfactory.js? [sm]:1 ERROR TypeError: Cannot read properties of undefined (reading ‘plugins’)
at AppComponent.deviceReady (main.js:sourcemap:3320)
at new AppComponent (main.js:sourcemap:3299)
at createClass (vendor.js:sourcemap:92371)
at createDirectiveInstance (vendor.js:sourcemap:92180)
at createViewNodes (vendor.js:sourcemap:103460)
at createRootView (vendor.js:sourcemap:103332)
at callWithDebugContext (vendor.js:sourcemap:104862)
at Object.debugCreateRootView [as createRootView] (vendor.js:sourcemap:104098)
at ComponentFactory_.create (vendor.js:sourcemap:91314)
at ComponentFactoryBoundToModule.create (vendor.js:sourcemap:87749)