Back button in android devices



I have a problem with registerBackButtonAction in my app,

i have slide menu and tabs for example my state is : menu.tabs.home ,

and i have som page without menu and tab for example my states is : aboutUs ,
setting, setting.language

i call my code about back button in .run in app.js

my problem is:

in tabs back button works fine and without bug but when i change state to for
example aboutUs or setting.language back button some time works fine and some
time not work !!!

i am so confused:( can you help me? where is my mistake?

my codes in run for back button is:$ionicPlatform, $state) {
  $ionicPlatform.ready(function() {
      $ionicPlatform.registerBackButtonAction(function (event) {
        else {
      }, 100);

Thank you.


because you are using the native back functionality… so you working with the browser history and not the ionic viewHistory.
$ionicHistory.goBack() instead of;


@bengtler no even alert not work
when i am not in tabs states ,some time back button event not fire and some time fire :

  $ionicPlatform.registerBackButtonAction(function (event) {
     alert( " this is not fire some times " )
  }, 100);


the priority 100 overwrites only the handling for ordinary statechanges as in tabs.

for popups, modals, popover, actionsheets you need to set a higher priority