How do I register a "back gesture"? [SOLVED]

0 favourites
  • 12 posts
From the Asset Store
Member System Register Login Logout Verify Email with database
  • How do I make my app register, when a user triggers the "back gesture" on their phone?

    I'm referring to the phone's navigation gestures, such as the back button on a navigation bar, or a swipe from the edge of the screen, when the user wants to go back to the last visited page.

  • It's in the browser object, on back button condition.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Could you please elaborate oosyrag?

    Maybe give an example, cause I'm not sure, where to find that "back button condition".

  • construct.net/en/make-games/manuals/construct-3/plugin-reference/browser

    On back button

    Triggered when the user presses the device's 'Back' button. Note not all devices have this button (e.g. iOS devices only have a 'Home' button) and not all platforms support this trigger.

  • Thank you so much oosyrag!

    I've no idea how I've missed it when I've looked multiple times. Guess I needed some sleep.

    The only problem I have now is that the device closes down the app when I use the "back gesture".

  • This is default behavior on android. For usability reasons, the back button should always consistently get you back to the home screen eventually.

    I believe you can interrupt this flow, against Google design recommendations, by opening a dialogue when the back button/guesture is called asking if the user is sure they want to quit. If the back button is pressed while the dialogue is open, it simply closes the dialogue.

    Basically make a situation where the back button is handled by an event/action of your own choosing at all times. Iirc there were also JavaScript options to disable the back button completely, but that would be decidedly unfriendly to your end users.

  • The only problem I have now is that the device closes down the app when I use the "back gesture".

    It is a cordova bug that makes the back-button terminate the app. The only way around it is to build with a fork of the splashscreen plugin, or to build with the regular plugin but comment out one line in the code or to remove the splash plugin totally from your project.

  • Problem is, I need the phone's back gesture to work just like the in-game back button, so that you can use it to go back to the last layout in the app, but it wants to close the app instead.

    I need it to override the "app closing" event.

  • The only way around it is to build with a fork of the splashscreen plugin, or to build with the regular plugin but comment out one line in the code or to remove the splash plugin totally from your project.

    How do I do this?

  • you build with cordova cli or with android studio. and remove or amend the splashscreen plugin, then it will work correctly.

    Unfortunately it's a bug in that plugin.

  • Unfortunately it's a bug in that plugin.

    Seems like a lot of unnecessary work. Do you know if they're working on fixing it?

  • Unfortunately there doesn't seem like any progress on this, that's why people have forked it and amended it

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