code: function onHardwareBackButton(e) {
      var backView = $ionicHistory.backView();
      if (backView) {
        // there is a back view, go to it
        backView.go();
      } else {
        // there is no back view, so close the app instead
        ionic.Platform.exitApp();
      }
      e.preventDefault();
      return false;
    }
docs: Triggered when devices with a hardware back button (Android) is clicked by the user This is a Cordova/Phonegap platform specifc method