Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
suspect7's avatar
suspect7
Honored Guest
9 years ago

How to call a website from a Gear VR App?

I'm working in Unity 5.3.4 on an app for the Gear VR, and I'm attempting to have a button that will load a URL in a browser. Right now, I'm just using this:
Application.OpenURL("http://unity3d.com/");
It tests fine on my computer, but when I attempt to use the link within the Gear VR, the phone freezes and the application can't be quit. It seems like others have tried something similar with no luck (here and here).

Am I going about this the wrong way? Any help would be hugely appreciated!

5 Replies

Replies have been turned off for this discussion
  • suspect7's avatar
    suspect7
    Honored Guest
    UPDATE. I've tracked down the source of the problem. The phone we were testing on had never had any attempts to launch a website from another app. It was trying to post a screen asking what app to use to open the link, but because it was in VR mode, the screen wasn't visible. We only figured it out once we were able to see this screen during one of the crashes. 

    Once we used a different app to launch a web link and select chrome, we were able to link from our app without a problem. This isn't really a fix for most people, but at least you'll have a better idea where to start looking!

     


  • vrdaveb's avatar
    vrdaveb
    Oculus Staff
    The approach you're using should work fine. When focus switches to the browser, Unity will automatically exit VR and the user should be able to undock the phone.
  • I was having the same problem with the GearVR app freezing, not switching focus to the browser, and not loading it in the background.  This was not caused by default browser window, and I've not seen any other solutions in other similar discussions.  I finally managed to figure out something that works:

    At first I found that if I placed an Application.OpenURL("http://www.whatever.com") in the Update function, then when I take the phone out of the GearVR the browser would open.  

    It turns out that if you put the Application.OpenURL call in the OnApplicationQuit function, then it will launch correctly when you take off the GearVR, i.e.

        void OnApplicationQuit()
        {

                Application.OpenURL(url);

        }

    Hope that helps other people.  It's been a long night trying to figure it out!

  • just adding to the thread.  if you do not have a default browser app set,  gear VR will hang.  you can explicitly call the browser on a url by replacing the https://  with googlechrome://