Forum Discussion
to_the_cosmic_end
1 year agoProtege
2D screen goes black when resizing the window (jetpack compose)
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>10 Replies
Replies have been turned off for this discussion
- liangliMeta Employee
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:
- to_the_cosmic_endProtege
This solution does not work on my project.
Here is the screenshot when the app is first launched:App launchedand here is after the window is resized:
After window is resizedI 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?
- liangliMeta Employee
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:
- JadeBirdHonored Guest
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.
- to_the_cosmic_endProtege
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
- JadeBirdHonored Guest
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.
- LeoMarquesNexusHonored Guest
I had the same issue and fixed by adding the following attributes to the hybrid activity:
android:configChanges="screenSize|screenLayout|orientation|keyboardHidden|keyboard|navigation|uiMode"
My activity block ended up looking like this:<activity android:name=".HomeActivity" android:exported="true" android:launchMode="singleTask" android:resizeableActivity="true" android:configChanges="screenSize|screenLayout|orientation|keyboardHidden|keyboard|navigation|uiMode" android:screenOrientation="landscape"> <meta-data android:name="com.oculus.vrshell.supports_free_resizing" maxSizeX="1600" maxSizeY="1000" minSizeX="800" minSizeY="500" android:value="true" /> <layout android:defaultWidth="1100dp" android:defaultHeight="650dp" /> <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>
Really hope this helps π - to_the_cosmic_endProtege
I'm not exactly sure what worked but now in Quest v71, it seems to be working as expected.
- kane7832Honored Guest
The 2D screen going black during window resizing could be due to rendering issues. Check your graphics settings or update drivers. Similar to resolving homeworkify not working common issues and find solutions when Homeworkify isnβt working effectively, troubleshooting often involves identifying compatibility issues and updating software to ensure seamless performance without disruptions.
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
- 8 months ago
- 6 months ago
- 2 months ago