Using Back button on phone to exit game via Crosswalk?

0 favourites
From the Asset Store
Forget about default textbox restrictions, you can create sprites atop of the textbox
  • As the title says, Is there a way of making my app/game detect when the phone Back button is pressed to exit the game? I've used CocoonJS before and that works fine but doesn't do anything with Crosswalk, is this something you have to enable?

  • im curious about that too!

    didnt find anything in the xdk, i made a work around that uses a sprite in game "on touched sprite->Browser-close" but thats not really cool

  • I can't understand, i have galaxy s3 and when i press back button in my games made with crosswalk, they are closing. And theres an action in browser "On back button released" or something like that.

  • I've found the 'On mobile back button pressed' action and used that to close browser. Must admit, not a fan of that as what happens is that as you press the back button, the screen turns white and then closes.

    Much prefer the CocoonJS way, where is asks if you want to exit when pressing the back button and doesn't have the white screen. It looks more professional that way.

    I find it odd that having the back button to exit isn't automatically there with Crosswalk, it just seems something normal to have with all apps.

  • I would suggest making your own exit menu and get the back button to spawn that and then get it to close when they tap/click/press yes?

  • Yeah i've actually tried that but i don't like the way it closes because, as mentioned before, the game turns to a white screen and then closes. It doesn't look great to be honest.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ah I see, sorry I thought you just meant the menu not appearing. I've never tried the close browser command myself, I will take a look tonight and see if it does the same for me.

  • I would suggest making your own exit menu and get the back button to spawn that and then get it to close when they tap/click/press yes?

    In my opinion, that's the best solution: I hate when mobile games just "close" and I don't know if they're still running in background (that is, leeching memory) or they have correctly quit.

  • rayray i don't seem to be having any problem with closing. It closes very smoothly on my moto e without a white screen and on the nexus 7 too

  • I've just tried it again it's working fine now. It closes smoothly and there's no white screen. I have no idea why it's working fine now and it wasn't before. I tried at least 6 or 7 times before and always had that white screen. Hope it stays that way

    Thanks for the replies.

  • rayray

    How about trying Phonegap Event plugin?

    I think crosswalk is on the phoneap, so phonegap plugin will be applied to.

    If you want, send me PM, I'll send you the plugin for nothing.

  • Thanks but i'm going to stick with using the browser close action, its working fine for me at the moment.

    Thanks for the suggestion though.

  • rayray can you please provide me more info on how to exit application compiled using crosswalk?

    thnx

  • The Browser object's 'On back button' and 'Close' features should work in Crosswalk. If not, please file a bug report.

  • cooltaby As Ashley mentioned, use the browser objects to exit the game, its still working fine on Crosswalk.

    Simple way is this: Browser - On Back button pressed - Browser - Close

    You could also create a sprite and when pressed, trigger the Browser 'Close' action.

    What i did was if the back button was pressed, a pop up will appear asking for confirmation to exit game. If yes is pressed then the Browser 'Close' will trigger, exiting the game. If no is pressed, then the pop-ups disappear and you get back to the game.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)