No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Quasar exiting app pressing back button

    Framework
    4
    5
    2083
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      nirmal last edited by nirmal

      I have just started to build a quasar app. When the app is installed in emulator or real device, I cannot exit the app pressing back button.

      Why my app doesn’t exit when I press back button? Do I have to implement something?

      The app is created via quasar init command

      The app is built via quasar build -m cordova -T android

      The apk is signed by jarsigner

      and then installed on device.

      The app works fine but when i try to exit app by pressing back button. The app won’t exit.

      1 Reply Last reply Reply Quote 0
      • nothingismagick
        nothingismagick last edited by nothingismagick

        Does this commit seem to be the same one you are facing?

        https://github.com/quasarframework/quasar/commit/ad08d33e54f283efeda3f1cfafed36a8b737deb0#diff-19f17119652f3ca089e2e90679f0e82eR30

        Might this snippet work for you?

        document.addEventListener("backbutton", onBackKeyDown, false)
        function onBackKeyDown(event) {
           navigator.app.exitApp()
        }
        

        src: https://stackoverflow.com/questions/16569269/handle-android-back-button-on-phonegap-inappbrowser

        N 1 Reply Last reply Reply Quote 0
        • N
          nirmal @nothingismagick last edited by

          @nothingismagick
          When I implement this in my app… MY app exits everytime i press the back button.
          I want my app to exit only when there is no window history.
          I tried to use window.history.length but it keeps on increasing as stated here
          So how can I exit app when I am in the ‘home’ of the app

          Thanks for your reply

          1 Reply Last reply Reply Quote 0
          • S
            snowdrop last edited by

            Try adding the replace directive as described here: https://quasar-framework.org/components/handling-back-button.html#Quirks
            I’ve got the same problem too and the that directive fixed it.

            1 Reply Last reply Reply Quote 0
            • L
              liuzhongshu last edited by

              I have the same issue, my app has a start page, and auto jumps to different pages based on some conditions, in the target page, I just want exit when back button is pressed, but the route is not “#/”, so just not work.

              This behavior is only found in the release version. when I do debug build using ‘quasar dev -m cordova -T android’, the back button is working, why?

              1 Reply Last reply Reply Quote 1
              • First post
                Last post