Hardware back button should never take you between tabs?

Within the context of an Android Cordova tabbed ionic app, users are tapping the hardware back button and things aren’t happening as they should.

In a “real” tabbed app, hitting the hardware button while on a tab with no inner-history should close the app, not navigate to a previous tab. Ionic tab behavior isn’t expected because going from one tab to the next goes into the history.

Here’s are a couple simple examples, assuming I have an app with two tabs, “Home” and “People”.

The user opens the app, “Home” is selected by default. They tap “People”, then hit the hardware back button. The app should close. But in ionic, it navigates back to the Home tab.

The user opens the app, “Home” is selected by default. They tap “People”, then tap a button on the “People” tab that navigates from People–>Person (the ionic back button is now correctly shown in the upper-left). Then they tap the “Home” tab. Then they tap the “People” tab. Then they tap the hardware back button. The correct behavior is for the app to go from Person–>People within that tab’s history, but instead it goes to the “Home” tab.

Essentially, the hardware back button should never take you from one tab to another. It should always close the app UNLESS there is the ionic back button showing in the upper left of the currently selected tab, in which case, it will navigate back in that tab’s history. How do i achieve the correct behavior in ionic?