Android Exit on Backbutton and Slide Menu on Menu Button



  • Hi,

    How manage both Android’s Back and Menu Button. So my question is split into 2.

    First how to slide the app menu when the use clicks on device’s menu button (especially Samsung)?

    The second issue is about the Mobile Device Back button (hardware) when clicking on it, it exists the application while it should return to homepage and if on homepage the client should click twice to exist.


  • Onsen UI

    @webiscore Hello!
    For the hardware menu button I guess you have to check Cordova: https://cordova.apache.org/docs/en/latest/cordova/events/events.menubutton.html

    About the back button, the default behavior of ons-navigator on device back button is to perform a popPage if there are pages in the stack. If there are no previous pages then it exits the app. Are you using ons-navigator or something else?



  • @Fran-Diox said:

    ons-navigator

    Yes I’m using ons-navigator. Can’t we override the poppage and do action without an alert to the customer?

    I’ll check the menu event behavior and try it.


  • Onsen UI

    @webiscore For now you can modify the ons-page back button handler since it has higher priority that the navigator one. You can use setDeviceBackButtonHandler(callback) and getDeviceBackButtonHandler().


Log in to reply