Beta 4, Hardware Back button not working


#1

Hi there,

I’ve updated to Beta 4(from beta 2) and now the Hardware Back button isn’t working,

I have no invocations of ionicbackbutton.functionThathandlesbackevent anywhere in my code

Is there anything I should enable?

Thanks


#2

I’ve got 2 apps running in a Geny Motion simulator. One apps has tabs and one is just a sidemenu app. Both are responding properly to the Android hardware back button. You should not need to do anything specific.

Questions:

  • Android Device
  • Android Version
  • Does the back button work in the simulator? Can you run in Geny Motion and see if it works there?
  • Can you post a simple code example on CodePen? One that does not work on your device? If so, we can test that code locally.

#3

Hi

I’m working with a note2 with android 4.3

I don’t use a simulator, just a few devices.

I’m not using any code that would do anything related to the back button,

I’ll get back to you tomorrow thank you very much,

I’ll try building a sample tabs app again(which I assume contains the latest beta)


#4

This is becoming really frustrating, I’ve wasted the day looking at why won’t the back button work on my update to 1.4,

The codebase is already getting big and I cant freaking update because of this issue,

I’ve been building starter apps left and right and I cannot replicate the problem


#5

I will solve this

:smile:


#6

Hi there

I have an app that logins in -> state.go(dashboard) it has tabs, but at this point the backbutton no longer works

I’ve tested in in the login -> register page(no state.go) and it works

but once I’ve used the state.go, the backbutton no longer works

Checking out ionPlatform

function onHardwareBackButton(e) {
if ($rootScope.$viewHistory.backView) { // there is a back view, go to it $rootScope.$viewHistory.backView.go();
} else { // there is no back view, so close the app instead
ionic.Platform.exitApp(); } e.preventDefault(); return false; }

Makes sense, but why isn’t it triggering after using $state.go()?

Do note this behavior I have in 1.0.2

Login page ->
dashboard tabs
check if user is from login page, if so, clear history
go to other tabs
press back
go to previous tab
once on dashboard(last tab) and back was still pressed -> exit app

behavior 1.0.5b

Login page
dashboard tabs
check if user is from login page, if so, clear history
go to other tabs
press back
Nothing happens


#7

Hi @ysrael,

Were you ever able to solve this. I’m having the exact same issue. And I also use tabs along with a $state.go or 2. The hardware back button seems to work fine for everything else, except for when it gets through all the history, it doesn’t exit the app.

I’m using the latest Ionic, v1.0.0-beta.11

Thanks!


#8

@ysrael
I face the same issue. I am using 1.2.8 version of ionic. I use a tabbed interface with .state(). The hardware backbutton works only sometimes. Is there a fix for this? I also tried this but still its not working.

$ionicPlatform.registerBackButtonAction(function () {
    navigator.app.exitApp();
}, 100);