Unable to disable force Dark Mode

I have used disable dark mode extension of @Mohamed_Tamer in Screen1. but still dark mode is working in my app. please help me to solve this issue. TIA :slight_smile:

Show your blocks so we can help you @Thuva


As @Mohamed_Tamer said, it’s enough to add his extension in screen1 to disable force Dark Mode. please solve my problem

It’s really confusing can you share aia if you want or else you have to contact the developer

1 Like

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

Hello @Mohamed_Tamer is there any more method to disable the dark mode as new apps has to be published as in aab bundle format and I think it is not editable through Apk Editor Studio :thinking:

Here is something @Anu10 try setting this to light theme and not on default if this is in default mode then its set’s the theme of android means if dark mode then dark and if light then light

:love_you_gesture:

I have already tried that and my project is already in light theme :sweat_smile:

It doesn’t disable dark mode for my app :roll_eyes:

Same problem :frowning:

Ok @Anu10 let me get some solution

ForceDark.aix (4.6 KB)
Test aix and let me know

:upside_down_face:

1 Like

PS: It worked, thanks to @Anu10 for testing

2 Likes

Is it work in all device?

Yes try this

But I can’t understand how to use this?

blocks (1)

It’s very easy @Avijit

You have to attach component in my view which you have to prevent from dark mode

And In force dark you have to set false (for disabling dark mode)

2 Likes