Supposing that you are using <ons-navigator var="myNavigator"></ons-navigator>
, have you already tried something like this?
// To disable a navigator back button handler
myNavigator.getDeviceBackButtonHandler().disable();
You should also not forget to add cordova.js
reference to your index page. You don't need to paste the file, it will be generated automatically every time you deploy a Cordova app.
<script src="cordova.js"></script>
If you don't add it, it will not be possible to manipulate the BackButton behavior.
Default behavior:
- Main page: closes the app.
- Other pages: goes back.
Disabling the handler, the app will be closed every time you press the button, regardless the page.