Android: Home-Button

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

Hi,

I (my costumer/client) have problem with home button:

loginWindow.addEventListener('android:back', function() {
    return false;   // this prevent window closing
});
loginWindow.addEventListener('android:home', function() {
    Ti.API.log('HOME pressed........');
    return false;
});
If I click home, then the process goes in background. Is it possible to avoid?

Rainer

2 Answers

Where did you get the "android:home" window event? That's not in the API docs.

Normal android behavior is to send an app into the background when the user hits the "home" button.

There is no android:home event to capture. In fact, a quick look at StackOverflow and other sources shows you can't do this natively either (without creative hacks, like making your app a Launcher to replace the default Android OS launcher).

From an app design perspective, why are you trying to prevent both a Back and Home operation? You could prevent the user from leaving your app, which would not be good.

— answered 8 months ago by Tim Poulsen
answer permalink
1 Comment
  • I'm finding that pressing home (or, say, an incoming call) are not firing the Pause event listeners.

    Using the back button repeatedly just closes the app all together. It's only if one presses home after pressing back just once (and the main window closes abut the splash screen is still displayed) that the listeners work correctly! ...but who would ever do that? A user would either keep pressing back until it closes (a perfectly fine outcome) or just press home to begin with.

    Any help would be gratefully received!

    http://developer.appcelerator.com/question/149942/pause--resume-events-dont-fire-android#comment-164391

    — commented 2 months ago by Robin Williams

Your Answer

Think you can help? Login to answer this question!