Search code examples
event-handlingblackberry-10back-button

How to override the device back button on BB10 Classic


Is it possible to override the hardware back button of the BB10 Classic? Pressing the back button on certain screens currently allows users to break the flow of my app.

How can I catch this button press to prevent it from navigating back?


Solution

  • I was able to override the back button by adding a DeviceShortcut with type DeviceShortcuts.BackTap to the qml file for the screen where I want to prevent users from going back.

    shortcuts: [
        DeviceShortcut {
            type: DeviceShortcuts.BackTap
            onTriggered: {
                // Don't allow the user to navigate back
            }
        }
    ]