Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49363

IONIC 4: Device back button not exiting the app

$
0
0

@augustofrr wrote:

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?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49363

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>