Hardware backbutton not working beta.6

i updated my project to beta.6,
but hardware backbutton event not working .
always closing app .


i tried another method but not working again .


Plase help , my app is closing always .

If I remember well Ionic team planned this for beta 5.

And yes this is still big issue which affects my project as well - 2 weeks until presentation to client :frowning:


Yep it was planned for phase 5 and commented as fixed:


@OmarHassan25 : @adamdbradley already fixed in git, milestone is set for beta 5, so guessing it will be included there.
1 Like

I have beta.6 installed and the Android back button does function properly so long as there are additional pages in the navigation stack. On the other hand, if you’re at a root page then the hardware button will close the app which is not the preferred result IMO. I think when you’re on a root page the back button shouldn’t do anything, or at the most it should us a prompt to ask the user if they want to close the app or not.

can you share your code please

Same issue here. Back button closes the app on beta.6. Am I supposed to add any additional code?

Current environment:
Cordova CLI: 6.0.0
Gulp version: CLI version 3.9.0
Gulp local: Local version 3.9.1
Ionic Version: 2.0.0-beta.6
Ionic CLI Version: 2.0.0-beta.19
Ionic App Lib Version: 2.0.0-beta.9
OS: Windows 7 SP1
Node Version: v0.12.7

Never ever use beta-tools for client projects :slight_smile:

Lesson learned a years ago but this wasn’t my decision but company’s :frowning:

And to be honest - excellent framework - saved me a log of headaches - those small thingies can be worked out this or that way :slight_smile:

1 Like

It sure is, but it’s still in beta. I really enjoy working in Ionic2, but I wouldn’t use it for production apps yet.

But we’re getting there :slight_smile: The only way to get it there, is by testing & reporting errors.

1 Like

any update , i cant fix this problem?

For me it works in beta 6 with exception on modals. That should be fixed.
Once you return to root page it close app.

Does not work correctly in beta 7! The event can be received but no possibility to interfere. This should be made possible by Ionic to kill the app on exit. Actually the problem is on root - the app leaves but the app can still be found in the app list. When activating it again, the app restarts(?) but without splash screen. As Ionic 2 takes actually too long to load, an ugly white screen is visible for several seconds. IMO opinion this is also related somehow to Crosswalk. Has anybody an idea on this?

I fixed it .

Find node_modules\ionic-angular\components\app\app.js Line :32

remove this function :

platform.backButton.subscribe(function () {
            var activeNav = _this.getActiveNav();
            if (activeNav) {
                if (activeNav.length() === 1) {
                else {

This isn’t because of crosswalk. I’m not using it and having exactly the same white screen for few seconds - this part really needs optimisation.

@lhteam thanks a lot!!! Yes, this works. Now it is possible to add own code in the event listener. IMO Ionic should remove this code.

The problem seems that the app is not suspended correctly with the back button. Try to press the “home” button instead of the “back button”. Afterwards resume from the app list. There will be no white screen. Apart that the loading of Ionic 2 takes too long, I don’t think it is related to Ionic.

@Vukasin The problem with the white screen can be reproduced with the simplest possible Cordova app (without Crosswalk and Ionic 2). Something seems to be wrong or we miss something. Anyhow, I filed an issue in the Cordova JIRA. As the JS of Ionic 2 is actually too heavy, the effect is visible very well. https://issues.apache.org/jira/browse/CB-11304

To show the splash screen on relaunch to avoid the white screen after “back button” exit, this option is needed in config.xml:
<preference name="SplashShowOnlyFirstTime" value="false" />

For Crosswalk additionally I updated to plugin version 1.7.0 (I don’t know if really necessary - however this made it work).

This is great!

Thanks a lot :smiley: