navigator.app.exitApp(); is not working in cordova app (Android, Vue, Quasar Framework)



  • hello.
    I tried exiting app on my android app. but, it’s not working.
    I am using quasarframework, vue2 and javascript.

    0_1518148244287_dialog.jpg

    ‘yes’ touch is not working.

    help me. thank you.

    • this is my code.
    methods: {
      onDeviceReady () {
        document.addEventListener("backbutton", this.onBackKey, false);
      },
      onBackKey() {
        Dialog.create({
          title: 'Exit',
          message: 'exit?',
          buttons: [
            {
              label: 'No',
              handler () {
              }
            },
            {
              label: 'Yes',
              handler: () => {
                this.onBackKeyResult();
              }
            }
          ]
        })
      },
      onBackKeyResult (buttonIndex) {
        if (buttonIndex == 1) {
          navigator.app.exitApp();
        }
      }
    },
    mounted: function() {
      document.addEventListener("deviceready", this.onDeviceReady, false);
    },


  • window.navigator.app.exitApp();



  • @eder-blinga
    hello.

    I tried to use this code.
    Didn’t work.



  • I’m pretty sure you dont need “deviceready” with quasar. In fact quasar wait for the device ready automaticatly.
    Anyway look at this maybe you need install <plugin name="cordova-plugin-whitelist" source="npm" spec="1.1.0" />.



  • @cklinx

    solved problems.
    As you said, “deviceready” was not necessary in the quasar.

    thank you.