How to disable hardware back button when using LoadingController

In android device when data is loading.

If i press hardware backpress it showing loading controller but going back to previous page.

screenLoading() {
    this.loader = this.loadingCtrl.create({
      spinner: 'crescent',
      content: 'Loading',
      dismissOnPageChange: true

I want to disable backpress when data is loading?

I had tried this below code it was working previously but its not working know in ionic 3

 constructor(public navCtrl: NavController, 
    public navParams: NavParams, 
    public driverInfo: DriverInfoProvider, 
    public menuCtrl: MenuController, 
    public driverServices: MyDriverServiceConnector, 
    public imcNav: IMCNavStack,
    public loadingCtrl: LoadingController,
	public plt: Platform) {
	this.plt.ready().then(()=>{ plt.registerBackButtonAction(() => { }); });


This code is not working know after updating to ionic 3
when i click on button β€”> page is not opening
if i comment this code and click on button β†’ page is opening

change it to

dismissOnPageChange: false
1 Like

Thanks for your response
I don’t want to go back when data is loading
I wanted to disable hardware backpress in android when data is loading

Hi, I developed a solution for this.
I did it by wrapping the LoadingController.

import {Injectable} from "@angular/core";
import {Loading, LoadingController, LoadingOptions, Platform} from "ionic-angular";

export class LoaderController {

    private loadingCtrl: LoadingController,
    private platform: Platform
  ) {


  create(opts?: LoadingOptions): Loading {
    let subscription;
    let loading = this.loadingCtrl.create(opts);

    loading.willEnter.subscribe(() => {
      subscription = this.platform.registerBackButtonAction(() => {
        console.log('back button pressed');
      }, 10);

    loading.onDidDismiss(() => {

    return loading;

Every Loading you create will replace the backButton original behaviour.

Just make sure in your project there is no backButton action with a higher priority (in this case, I set it to 10).