Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
motorsep's avatar
motorsep
Start Partner
10 years ago

[Gear VR] Back button handling - how ?

How do I detect back button long press and short press using Blueprints and what function do I call for quitting to Oculus Home and universal menu ? Thanks!

7 Replies

Replies have been turned off for this discussion
  • artyom17's avatar
    artyom17
    Expert Protege
    You need to set 'gearvr.HandleBackButton' console variable to 1 (either in ConsoleVariables.ini or in [SystemSettings] section of ...Engine.ini (Base... or Default...).
  • artyom17's avatar
    artyom17
    Expert Protege
    If you'd like to repro the default behavior (which is already there if you don't  set 'gearvr.HandleBackButton' in 1) - yes. If you'd like to add custom logic then all what you need is to handle "Android Back" button.
  • Interestingly enough, UE4 4.11pre8 doesn't have such console cmd :/

    I followed this tutorial to the tee https://docs.unrealengine.com/latest/INT/Platforms/GearVR/GlobalMenu/index.html and on the device, if I do short press, I get "Do you want to exit to Oculus Home?". If I press No, I go into Universal menu instead of my game o.O

    If I do long press, I go into Universal menu from which I can't go back into the game.
  • Alright, I added that cmd - with cmd set to 0, back button doesn't work at all. With cmd set to 1 it works, but I am still getting exactly the same issue as when I didn't have that cmd on eventBeginPlay.

    Here is how it looks like in the level BP:


    Here is my BP for back button, taken straight from the Epic's docs:

    full image: http://s17.postimg.org/fozbnmwz1/ue4_gearvr_backbutton_BP.png

    Interesting thing - the app doesn't crash. If I use Back button and go into UM, and then into Oculus Home, I can simply remove phone from GVR, press that button to the left of phone's Home button, select my app that is still running and I will be asked to put phone into GVR. Once I do that, I am back in the game.

    @artyom17: I am going to PM you a link to my project. Maybe it would be easier to determine whether I am doing something wrong (and what in particular) or UE4 still has a bug.

    I am blaming Epic's outdated docs :blush: 

    P.S. If I press K in the Editor when playing, progress bar appears as I hold K key.
  • Finally got it working !!!

    Now I have another question: https://answers.unrealengine.com/questions/396823/gear-vr-how-to-shut-down-app-on-exit-to-the-store.html

    Is it a bug or standard behavior?