Ionic 4: Display Alert Before App goes to background

#1

Hi how to display an alert before an app moves to background?

#2

Got it!!!
Inn app.component.ts file

public resumed:boolean = false;
  constructor(
    private platform: Platform,
  ) {    
    this.platform.resume.subscribe((res) => {
      if(this.resumed == false){
      
         alert("resumed");
          this.resumed = true;
        }
        
      }); 
      this.platform.pause.subscribe((paus) => {
      this.resumed = false;
      alert("pausing");
      });
  }
#3

Im faced with same problem in my ionic 4 project.
But above code does not work for me.
I want to use this ability in my page.
can you guide me to do this?
Thank you