Android back button visiting entire history to come back on home page


#1

Android back button visiting entire history to come back on home page previously in jquery mobile it was not visiting entire web site to go back to home page.

suppose my page visits like

Home - > Result List -> Result Detalis - > back to Result List -> Again Result Details

Now if i press Android back button it goes like

Result Details – >Result List – > Result Detalis --> Result List - > Home

instead of above android back button should go

Result Details – >Result List - > Home


#2

Are you pressing a ion-nav-back-button when going back to your results? If not, then that would explain why.

UI-router will treat each state change as a new log in your history, even if your technically going to a “previous state” ( the state that you were in before the current one)


#3

Is there any update on this …
yes i am using ion-nav-back-button inside ion-nav-bar to coming back and for going forwrad i am using ng-href or $state.go("") …but still my android back button visiting entire visited history…Like

suppose i visited
Home - > Result List -> Result Detalis - > back to Result List -> Again Result Details

so it should go to home page after clicking two times on device back button but it visiting entire visited page and needs to click 5 times to go back to Home…

am i doing anything wrong here???


#4

Is there any update on this its still pending…


#5

Hey, sorry, things have been crazy over here.

So I created a sample project with a situation like you have described and could not reproduce you issue. The nav-back-button actually behaves like you expected.

Are you using android webview in android studio?


#6

yes i am using Android studio web …Is ionic routing not sporting in android studio??


#7

Not too sure, I’ve never used Android studio’s web view app setup. Why don’t you try this in the browser or in cordova.


#8

I have a doubt about this too.
Let’s say Im taking a quiz. And after the 50 questions, I want the user to go back to the Quiz Home. How can I go to the home and avoid the user to hit the back button?


#9

I met same situation and not know why until I realized “registerBackButtonAction” using “navigator.app.backHistory();”

var taptimes = 0; var deregister = $ionicPlatform.registerBackButtonAction(function () { if ($state.current.name == "tab.dash") { taptimes++; if (taptimes < 2) { $cordovaToast.showShortBottom('再按一次退出软件').then(function (success) { // success $timeout(function () { taptimes = 0; }, 3000) }, function (error) { // error taptimes = 0; }); } else { taptimes = 0; ionic.Platform.exitApp(); } } else { $ionicNavBarDelegate.back(); // navigator.app.backHistory(); <-- this will go back to history not parent!!! } }, 100); $scope.$on('$destroy', deregister)