Exit app on Android back button from every window.

You must Login before you can answer or comment on any questions.

I just can't force this to work. It work on my first opened window. But all of my windows have navbarhidden : true which makes them heavyweight.

I just want to exit app when I press back button in any of opened windows.

1 Answer

In your first window, or wherever you create your main window or tabgroup, just listen for the app event for the back button and then close that main window.

Ti.App.addEventListener('android:back', function() {
    win.close();
});
On a side note, this breaks the whole point of the Android back button, and just personally speaking, I'd more than likely be really upset if I ran into this scenario out in the wild.

— answered 9 months ago by Anthony Decena
answer permalink
2 Comments
  • I agree with Anthony's comment. It sounds like you're trying to force iPhone-like behavior onto an android app. It would definitely violate the Principle of least astonishment for android users like me!

    — commented 9 months ago by Jason Priebe

  • I just refactored my code to use one window with two windows instead of two windows.

    — commented 9 months ago by Dino Bartosak

Your Answer

Think you can help? Login to answer this question!