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.
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.
-
@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.htmlAbout the back button, the default behavior of
ons-navigator
on device back button is to perform apopPage
if there are pages in the stack. If there are no previous pages then it exits the app. Are you usingons-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.
-
@webiscore For now you can modify the
ons-page
back button handler since it has higher priority that the navigator one. You can usesetDeviceBackButtonHandler(callback)
andgetDeviceBackButtonHandler()
.