Fellow android devs,
I'm developing a Jetpack Compose Native App and recently the app stopped rotating when I rotate the device. The auto rotate is ON. I tried two emulators Pixel 9 and 8 and a physical device with SDK 30. No idea what happened because I can't track any changes related to device rotation.
That's my manifest:
<application
android:name=".app.android.App"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:enableOnBackInvokedCallback="true"
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="@style/Theme"
tools:targetApi="35">
<activity
android:name=".app.host.MainActivity"
android:exported="true"
android:theme="@style/Theme"
android:windowSoftInputMode="adjustNothing"> <!--adjustNothing is used to deal with imePadding-->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Theme:
<style name="Theme" parent="Theme.Material3.DayNight">
<item name="android:windowIsTranslucent">true</item>
</style>
I have "custom splash screen that's why I set the "windowIsTranslucent".
Also, I use the GoogleMap SDK but the rotation is not happening on any screen.
N.B. - I'm not aiming to force portrait and also the auto rotate works across the device.
Basically the problem is the android:windowIsTranslucent
. More information here: android:@Theme.Translucent Locks orientation to Portrait?
To fix that either add android:screenOrientation="sensor"
to the activity (only one in compose app) or find a different way to create a custom splash screen.