The default in Onsen is that the app closes/exits when the device backbutton is pressed. Is there any way to control that in Onsen to also mimic the ons-navigator action/page history?
Thanks!
The default in Onsen is that the app closes/exits when the device backbutton is pressed. Is there any way to control that in Onsen to also mimic the ons-navigator action/page history?
Thanks!
No need to handle backbutton event to prevent application being killed. Onsen-ui Added support to android back-button on ons-navigator and ons-sliding-menu from v1.1.1.
You can check here
You can controll it with "disableDeviceBackButtonHandler" after ons.ready event. After that add a event listener for back button and do anything you want.
Just check this article: https://onsen.io/guide/overview.html#HandlingBackButton
In case of PhoneGap/Cordova, backbutton event is fired when the backbutton is pressed. Therefore, you can set the eventhandler s.t.
In eventhandler function, you can call popPage method of navigator by obtaining the navigator scope s.t.
If you are using Monaca, the hybrid application framework based on Cordova, the backbutton event is not fired. Instead that you can use the .ui file in which the Backbutton event is defined s.t.