I have an Android app which implements a WebView.
This WebView contains WebVR content.
If I view the HTML in the Quest's native web browser, the fullscreen function works. But it doesn't work in the Android WebView.
When I load the APK onto the Oculus Quest 2, I can launch it and interact with it in a window:
When I interact with the "VR" button on screen, the window goes blank.
I want it to go into fullscreen / immersive mode.
The Immersive API is deprecated.
I'm trying to use the Oculus Native Manifest but that crashes with:
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
I'm unsure what other information I need to provide - but here's my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="my.package.name">
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
tools:targetApi="31"
android:configChanges="density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode"
android:launchMode="singleTask"
android:resizeableActivity="false">
<meta-data android:name="com.oculus.intent.category.VR" android:value="vr_only"/>
<meta-data android:name="com.oculus.supportedDevices" android:value="quest|quest2"/>
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="23"/>
<uses-feature android:glEsVersion="0x00030001" />
</manifest>
And my MainActivity
package my.package.name
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.webkit.WebView
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
var webView = findViewById<WebView>(R.id.webview)
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("file:///android_asset/test.html");
}
}
