Quasar exiting app pressing back button
-
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
commandThe 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.
-
Does this commit seem to be the same one you are facing?
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
-
@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 appThanks for your reply
-
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. -
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?