I’ve been trying to close the app with the device back button but instead of, it goes to a white screen and then go back to the home page.
I tried this:
import { Component } from '@angular/core';
import { Platform } from '@ionic/angular';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
constructor(private platform: Platform) {}
subscription: any;
ionViewDidEnter() {
this.subscription = this.platform.backButton.subscribe(() => {
navigator['app'].exitApp();
});
}
ionViewWillLeave() {
this.subscription.unsubscribe();
}
}
It seems to work to some people, there’s something wrong i’m doing?