5

In android GearVR, is it possible to launch an application in normal/phone mode, and then have it transition to Unity/VR when the user clicks a button to go into VR?

So far the app either launches completely in VR with "vr_only" as an option, or launches normally and goes to Oculus Home when we try "vr_both" or "vr_dual".

Is such a thing possible, or will we have to make two separate apps? Please note that using the "Virtual Reality Supported" option in Unity will not work on the Gear.

Milad Yarmohammadi
  • 1,253
  • 2
  • 22
  • 37
Pat
  • 1,193
  • 1
  • 11
  • 36

1 Answers1

5

I won't say that it is impossible but would be difficult to achieve as there is not simple way to do this. Using Virtual Reality Supported option in player settings as suggested by @Programmer is not an option. You can either check it or un-check it before building the app. Changing it later through code does not work for android build.

You can build a non-VR App and write native plugin to give users an option to start VR App which may be a different app (with a different bundle identifier). I am not good with native code so can't help you much with exact way to do this. Instead you can have a look at following links:

  1. http://answers.unity3d.com/questions/259935/open-app-from-other-app.html

  2. http://forum.unity3d.com/threads/android-ios-launch-from-within-a-unity-app-another-unity-app.222709/#post-1486300

  3. Is it practical to start a Unity game from an Android app and revert back from Unity to the app?

For more information on this topic follow this forum post on oculus forum: https://forums.oculus.com/developer/discussion/26935/gearvr-app-within-android-app

Community
  • 1
  • 1
Umair M
  • 10,298
  • 6
  • 42
  • 74
  • 1
    Yes. Either way the Virtual Reality Supported will not work with GearVR for some reason. We need to disable it so that it compiles. It's very weird that it doesn't work with a single app.. We already have Vuforia/Unity launching in the same app without any problems. I wonder why Samsung made it so hard to do something like that. :( – Pat Aug 17 '16 at 05:29
  • I forgot to mention that the reason we're trying to use the same app is so that we can share session/login inside the VR. I don't know if that's possible with 2 apps without breaching security. – Pat Aug 17 '16 at 05:31
  • 1
    Oculus did it this way so you can only publish your apps through their App Store. And when you actually publish your app at Oculus store, you have to run it from Oculus home app like other apps. And regarding login/session maintaining, I don't know much about it. I would suggest you to research about it. One good option will be to use [Sign in with Google](https://support.gamesparks.net/support/discussions/topics/1000063337) as your app is eventually going to android and every android has a google account. But remember, you can not do everything in VR Apps yet. – Umair M Aug 17 '16 at 09:35
  • 2
    About this security issue - you could try passing a login token (session id etc) via an intent between apps. You could do some symmetric encryption on both ends with a hardcoded password - wouldn't be 100% proof, but would require a lot of effort and making the user install another spoofed app to eavesdrop on this intent. – Krzysztof Bociurko Aug 17 '16 at 09:44
  • Thank you both. I was reading up on Content Provider and how I can restrict it to only give info for the apps signed with our certificate. We're going to go with that. – Pat Aug 17 '16 at 10:21