# Control the android back button navigation

**URL:** <https://forum.ionicframework.com/t/control-the-android-back-button-navigation/30112>\
**Category:** ionic-v1\
**Created:** [August 7, 2015, 5:14pm UTC](https://forum.ionicframework.com/t/control-the-android-back-button-navigation/30112 "2015-08-07T17:14:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![windam82](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/windam82/32/14332_2.png) [@windam82](https://forum.ionicframework.com/u/windam82)\
**Post date:** [August 7, 2015, 5:14pm UTC](https://forum.ionicframework.com/t/control-the-android-back-button-navigation/30112/1 "2015-08-07T17:14:56Z")

</div>

Hi,

I tried many different solutions to avoid the android back button  
goes to the previous view, but without positive results.

I’ve a “start” state and, when the job is done, the application  
goes to a “home” state through the $state.go function.

I tried:

- registering a callback back action using $ionicPlatform
- using the nav-clear directive on the next view
- using $ionicHistory.clearHistory
- using $ionicHistory.currentView($ionicHistory.backView())
- using $state.go(“home”, {}, {location: “replace”})
- using $state.go(“home”, {}, {location: “replace”, notify: false})
- using $ionicHistory.nextViewOptions({disableBack: true})

What can I do to solve the problem?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![bengtler](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/bengtler/32/98565_2.png) [@bengtler](https://forum.ionicframework.com/u/bengtler)\
**Post date:** [August 7, 2015, 8:22pm UTC](https://forum.ionicframework.com/t/control-the-android-back-button-navigation/30112/2 "2015-08-07T20:22:18Z")

</div>

use:

```
$ionicPlatform.registerBackButtonAction(function () {
     // do something
     
 }, 100);

```

[http://ionicframework.com/docs/api/service/$ionicPlatform/](http://ionicframework.com/docs/api/service/%24ionicPlatform/)

---

<div class="post-metadata">

**Author:** ![windam82](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/windam82/32/14332_2.png) [@windam82](https://forum.ionicframework.com/u/windam82)\
**Post date:** [August 7, 2015, 8:32pm UTC](https://forum.ionicframework.com/t/control-the-android-back-button-navigation/30112/3 "2015-08-07T20:32:25Z")

</div>

> [@bengtler](#):
>
> use:
> 
> ```
> $ionicPlatform.registerBackButtonAction(function () {
> // do something
>      
> }, 100);
> 
> ```
> 
> [$ionicPlatform - Service in module ionic - Ionic Framework](http://ionicframework.com/docs/api/service/$ionicPlatform/)

I tried already this solution but doesn’t works.  
But after **many and many and many** tests,  
I tried with priority 101 instead of 100 and… It works correctly. 😅

Thanks anyway.
