Forum Discussion
suspect7
9 years agoHonored Guest
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:
Am I going about this the wrong way? Any help would be hugely appreciated!
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
- suspect7Honored GuestUPDATE. 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!
- vrdavebOculus StaffThe 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.
- hugoglitchersExplorerI have a more elegant solution to this to avoid the jarring visuals of the app freezing when you try to open the URL.The code is here - https://gist.github.com/glitchersgames/557bc2dce118221b5e3734c2e900fac9If the player takes the headset off and puts it back on they will be returned to where they were in the game. You could show a message to the user telling them to remove the headset + device to see the website.
- tacticalspaceHonored GuestI 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! - spiraloidProtegejust 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://
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 2 years ago