Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

Device back button exits app in debug build



  • Hello!
    I’m building a mobile app using Vue 2.0 and Onsen UI.
    I used this https://github.com/OnsenUI/vue-onsenui-kitchensink as a base for my application.

    And while I’m testing my app in my browser using “yarn run dev” everything works as expected, I can simulate the device back button using the ESC key and it works just like it’s supposed to.
    However, after I build the project using “yarn run build” and upload it to Monaca, build a debug apk and install on my phone, the back button simply exits the app on every page. Same thing happens in the Monaca Debugger app.

    Something else I noticed that might be related is that when I install the apk on my Samsung S8 the app is moved to the “Game Launcher” app as if it was a game, and the navigation field (with the home and back button) gets the additional options for locking etc as you get when launching a game.

    Any ideas on what might be causing this?
    Thanks for reading!

    Edit: So I solved the Game Launcher bug but still have the back button exit the app. I’ve done some testing and the back button is still exiting the app in the original kitchensink project I used as a base. So I haven’t broken anything but it seems the way the kitchensink project is built with the navigation makes the default behaviour of the back button not work. So I guess the easiest way to solve this would be to include some javascript in each page that I want to have the back button work that makes the back button fire a pop-page event.

    Could someone point me in the right direction to how this code would look?



  • This post is deleted!


  • The problem was that the kitchensink project doesn’t include cordova.js as it is made for browsers.

    The back button problem was solved by simply including “<script src=”./components/loader.js"></script>" in my index.html