Launch Oculus or Samsung browser from within a Gear VR app
Dear all I searched a bit and didn't find an answer, so if someone already asked, please lead me to it. When I am in my unity based app, I want to be able to launch a link to any site, but make it launch in the Oculus or Samsung browser while still with my goggles on. When exiting the browser, I want to be back in my app. The browser should launch in 2D mode, and continue so, unless the user goes stereoscopic. Can this be done? Thanks1.1KViews0likes3CommentsSamsung Internet in VR mode with Intent
Hello, I would like to open Samsung Internet Browser in VR from my Unity App. I wrote a code which opens the browser but the URL doesn't load. In that code I use "com.sec.android.app.svrbrowser" to identify the application. If I use "com.sec.android.app.sbrowser" without vr and without VR mode (so a normal appplication) then the normal browser opens and loads my URL. So my problem is that I want to open the VR browser with a specific URL, not in blank. I would appreciate it any help. Thanks. The code: { bool fail = false; string bundleId = "com.sec.android.app.svrbrowser"; // your target bundle id AndroidJavaClass up = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject ca = up.GetStatic<AndroidJavaObject>("currentActivity"); AndroidJavaObject packageManager = ca.Call<AndroidJavaObject>("getPackageManager"); AndroidJavaClass intentStaticClass = new AndroidJavaClass("android.content.Intent"); AndroidJavaClass packageManagerStaticClass = new AndroidJavaClass("android.content.pm.PackageManager"); AndroidJavaClass uriClass = new AndroidJavaClass("android.net.Uri"); AndroidJavaObject uriObject = uriClass.CallStatic<AndroidJavaObject>("parse", url); AndroidJavaObject launchIntent = null; try { launchIntent = packageManager.Call<AndroidJavaObject>("getLaunchIntentForPackage", bundleId); launchIntent.Call<AndroidJavaObject>("setAction", "android.intent.action.SBROWSER_VIEW_FOR_EXTERNAL_APP"); launchIntent.Call<AndroidJavaObject>("setData", uriObject); launchIntent.Call<AndroidJavaObject>("setPackage", bundleId); } catch (System.Exception e) { fail = true; } if (fail) { //open app in store Application.OpenURL(bundleId); } else {//open the app ca.Call("startActivity", launchIntent); } up.Dispose(); ca.Dispose(); packageManager.Dispose(); launchIntent.Dispose(); intentStaticClass.Dispose(); uriClass.Dispose(); uriObject.Dispose(); }908Views0likes1Comment