a week ago
Hi, I am trying to build a simple hybrid app but the problem is as soon as I resize my window, it goes completely black.
here is the Basic MainActivity:
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
App()
}
}
}
@Composable
fun App() {
Column {
Text("Hello World!", color = Color.White)
}
}
and here is the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:horizonos="http://schemas.horizonos/sdk">
<horizonos:uses-horizonos-sdk
horizonos:minSdkVersion="69"
horizonos:targetSdkVersion="69"
/>
<uses-feature
android:name="android.hardware.vr.headtracking"
android:required="true"
/>
<uses-feature
android:name="oculus.software.handtracking"
android:required="false"
/>
<uses-permission android:name="com.oculus.permission.HAND_TRACKING" />
<uses-feature
android:name="com.oculus.experimental.enabled"
android:required="true"
/>
<uses-feature
android:name="com.oculus.feature.PASSTHROUGH"
android:required="false"
/>
<uses-feature
android:name="com.oculus.feature.VIRTUAL_KEYBOARD"
android:required="false"
/>
<uses-feature
android:name="oculus.software.vr.app.hybrid"
android:required="false"
/>
<uses-feature android:glEsVersion="0x00030001" />
<uses-feature
android:name="oculus.software.overlay_keyboard"
android:required="false"
/>
<uses-feature
android:name="com.oculus.feature.RENDER_MODEL"
android:required="false"
/>
<uses-permission android:name="com.oculus.permission.RENDER_MODEL" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:label="@string/app_name"
android:theme="@style/Theme.PanelAppThemeTransparent"
android:supportsRtl="true">
<meta-data
android:name="com.oculus.supportedDevices"
android:value="quest2|questpro|quest3"
/>
<meta-data
android:name="com.oculus.handtracking.version"
android:value="V2.0"
/>
<meta-data android:name="com.oculus.vr.focusaware" android:value="true" />
<uses-native-library
android:name="libossdk.oculus.so"
android:required="true"
/>
<activity
android:name=".MainActivity"
android:exported="true"
android:screenOrientation="landscape">
<meta-data android:name="com.oculus.vrshell.free_resizing_lock_aspect_ratio"
android:value="true" />
<layout android:defaultHeight="800dp" android:defaultWidth="800dp" />
<meta-data
android:name="com.oculus.vrdesktop.control_bar_config"
android:value="{'show_title':false,'show_report_bug':false,'with_back_button':false, 'use_activity_label':false}"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="com.oculus.intent.category.2D" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
a week ago
Hi, to enable resizing, you also need to add the meta-data in the activity's manifest:
<meta-data android:name="com.oculus.vrshell.supports_free_resizing" android:value="true" />
Here's the sample hybrid app for resizing config:
a week ago
This solution does not work on my project.
Here is the screenshot when the app is first launched:
and here is after the window is resized:
I am guessing maybe spatial SDK works with XML for initial 2D screen and the Jetpack compose can be embedded only in the 2D panel inside the 3D screen?
a week ago
Hi, I tested it for Jetpack compose with hybrid panel, it works as expected.
It could be the layout issue within your panel. You may want to double check the hybrid app's config and your layout.
Hope these helps:
a week ago
How do you start the app? I had a similar issue, if I start the app using Android Studio or adb, resize would make the app go black. But if I start it from the shell then it works fine.
a week ago
Hi, thank you for your reply. I tried this repo as it is and I still see black screen when resizing the window (Quest 2 v69, Android Studio Ladybug | 2024.2.1 Patch 1):
a week ago
I've been running it from Android Studio. Can you tell me how to start the app from the shell? I tried this command but with same result:
adb shell am start -n com.meta.spatial.samples.hybridsample/com.meta.spatial.samples.hybridsample.Ma
inActivity
Friday
Sorry, I meant the Meta UI shell 😀. In the headset go to the Applications Library and launch it from there. Or you might already have in the taskbar.