Unable to disable force Dark Mode

Hello @Thuva,
The approach used in my extension might not work across all android devices, here’s another approach which should work better:
1- First, you will need an apk editing tool (i.e: APK editor studio), so you can edit the app styles.
2- Open your APK, locate the res/values/styles.xml file
3- Find this line ( the parent attribute might not be exactly the same if you use a diffrent theme for your app other than the default theme ) :
<style name="AppTheme" parent="@style/Theme.AppCompat">
And add this line right after it:
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item> to disable force dark mode on the app, so the style would look at last similar to this:

    <style name="AppTheme" parent="@style/Theme.AppCompat">
        <item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
        <item name="android:windowBackground">@drawable/splashicon</item>
        <item name="android:windowActionBar">false</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="colorControlNormal">@color/colorAccent</item>
    </style>

4- Save the modified Apk, when promoted to import your keystore, choose the keystore you get from Account>Settings>Export Keystore, the default keystore password is android.


Reference: https://stackoverflow.com/a/64999338

8 Likes