IONIC2/3 Register for Android back

Source: Internet
Author: User

If you use the

This.app.getRootNav (). push () and This.navCtrl.push ();  when registering the Android return key   registerbackbuttonaction () {         if (!this.nativeservice.isandroid ()) {          return;        }         this.platform.registerbackbuttonaction (() = {          if (This.keyboard.isOpen ()) {//Hide keyboard If keyboard is turned on              this.keyboard.close ();             return;        }        // Click the Back button to hide the toast or loading or overlay         this.ionicapp._ Toastportal.getactive () | | This.ionicapp._loadingportal.getactive () | | This.ionicapp._overlayportal.getactive ();        //Hide modal         let Activeportal = this.ionicapp._ Modalportal.getactive ();         if (activeportal) {             activeportal.dismiss ();             return;        }         //Page return          if ( This.app.getRootNav (). CanGoBack ()) {            // This.showexit () this.nativeService.minimize ()                  return this.app.goBack ()         }else{                 return This.showexit ();                          }        },     }//double-exit the prompt box      showexit () {        if (this.backButtonPressed) {// When the trigger flag is true, double-click the return button within 2 seconds to exit app             THIS.PLATFORM.EXITAPP ();         } else {             this.nativeservice.showtoast (' Press again to exit the app ');             this.backbuttonpressed = true;             settimeout (() = {///2 seconds without clicking back again marks the trigger flag as false                 this.backbuttonpressed = false;              },         } )    }

IONIC2/3 register for Android back

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.