Disable back button ANDROID

  • Does anyone know how to disable the back button on an Android mobile game?

    In the past, when I pressed it a message popped up asking me if I wanted to close the app. I believe this was with CocoonJS, however I'm now using Cordova.

    Now, when I press it, the game instantly closes without any notifications. I'm building a game that requires the player pass the phone to another player, and on occasion, with my phone (Samsung Note) a player can press the back button by mistake. If they press any other button, including the power button, the game remains open. The back button, however, as I said, closes it, and when you open it again, it starts from the beginning.

    Any ideas?

  • Does anyone know how to disable the back button on an Android mobile game?

    In the past, when I pressed it a message popped up asking me if I wanted to close the app. I believe this was with CocoonJS, however I'm now using Cordova.

    Now, when I press it, the game instantly closes without any notifications. I'm building a game that requires the player pass the phone to another player, and on occasion, with my phone (Samsung Note) a player can press the back button by mistake. If they press any other button, including the power button, the game remains open. The back button, however, as I said, closes it, and when you open it again, it starts from the beginning.

    Any ideas?

    if you use Cordova then you should try this

    https://cordova.apache.org/docs/it/5.4. ... utton.html

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • NN81 Do you know how or where I'm meant to implement that? As far as I can see, it's just a bunch of code without any instructions of where I need to put it. Sorry for the hassle.

    What I ended up doing was adding the browser plugin to my game and giving the back button a function. This meant when a player pressed it, it didn't close the program.

  • NN81 Do you know how or where I'm meant to implement that? As far as I can see, it's just a bunch of code without any instructions of where I need to put it. Sorry for the hassle.

    What I ended up doing was adding the browser plugin to my game and giving the back button a function. This meant when a player pressed it, it didn't close the program.

    I think you have to edit some file before building apk, if you google i think you'll find something more specific about to do it.

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