Ionic backbutton click not working

Hi, help me

import { Component } from '@angular/core';

import { Platform, ToastController } from '@ionic/angular';

import {  } from '@ionic/angular';
@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {
private subscription;
private sec;
  constructor(private platform: Platform,
    private toastController: ToastController
    ) {
    this.subscription = this.platform.backButton.subscribe(async()=>{
      if(this.sec == 0)
      {
        const toast = await this.toastController.create({
          message: 'Press Back again to Exit',
          duration: 2000
        });
        toast.present();
        this.sec=1;
        setTimeout(()=>{
          this.sec=0;
        },5000);
      }
      else
      {
        navigator['app'].exitApp();
      }
  });
  }
}

Hi, Here I given link.Please refer this link

Thanks,