Page 1 of 2
How to Force Dark Mode?
Posted: 03 Jul 2020 14:03
by Philip
My Samsung Galaxy Note 10+ has an option under Settings > Developer options > Force Dark mode. This forces all apps (even those which don't have a native Dark Mode) to use a "dark mode" setting.
Unfortunately this setting unsets itself every time I reboot my handset, so I have to manually turn it back on.
I'd like to get Automagic to do this for me. I can use Start Activity with android.settings.APPLICATION_DEVELOPMENT_SETTINGS in the action field to open Developer Options, but can't see any way to toggle Force Dark Mode.
Is this possible?
Re: How to Force Dark Mode?
Posted: 03 Jul 2020 21:25
by Micky Micky
Hello,
It may be possible with additional information in the START ACTIVITY action. I cannot help you with that.
Normally CONTROL UI action would provide a solution but the Overlay Control doesn't work with Settings pages. So you can't get the toggle switch information.
However, one crude (and it's very crude) solution is to use the gesture recorder to record swipes up and a swipe across. This will simulate the actions you do when changing the setting manually.
You can't record the gestures on the settings page, but you can on the Automagic screen. A lot of trial and error is involved to get it right. I would wait to see if someone can provide the information required for START ACTIVITY settings.
Good luck
Micky
Re: How to Force Dark Mode?
Posted: 04 Jul 2020 12:06
by Hit
Hello, Philip.
I have an idea that you can use
Action: Set System Setting to change the setting that make your phone to force dark mode if it exist.
You can find it yourself.
Another way you can try this to find that setting if it is exist:
Secure Setting Logger
Re: How to Force Dark Mode?
Posted: 04 Jul 2020 13:10
by Micky Micky
Hello
The setting exists on my Samsung S10
display_night_theme
But it only toggles the setting, it doesn't activate it.
Nice approach if it did work. Still worth trying as results can vary depending on the phone.
Thank you
Micky
Re: How to Force Dark Mode?
Posted: 05 Jul 2020 15:05
by Desmanto
Most of the time, setting in the developer option are protected by special API. You might need to open the setting page again to force the system reread the secure setting you have changed.
The other way is to open the development setting, use the control UI scrollForwardById(elementid) several times until the designated toggle and then use clickById() or other type to toggle the dark mode. If you don't restart the mode frequently, some UI distraction at every reboot should be tolerable.
Re: How to Force Dark Mode?
Posted: 05 Jul 2020 15:21
by Micky Micky
Hello,
Control UI can't use the overlay on settings pages.
Try it.
Micky
Re: How to Force Dark Mode?
Posted: 05 Jul 2020 17:43
by Desmanto
@Micky : I just tested it, scrollForward() works fine in the developer options. I don't know with other phone/ROM, but it is working at my RN5 Whyred, with ROM AEX 6.7, based on Pie 9.0. Maybe some other ROM protect the setting pages or flagged it as secure, so can't be accessed by Accessibility.
Re: How to Force Dark Mode?
Posted: 05 Jul 2020 17:54
by Micky Micky
Desmanto,
You can't use ClickById etc because the overlay function of Control UI doesn't work in that settings page. Unless you know another way.
Yes you can scroll about, that's what my original suggestion was explaining. My method involves a bit of trial & error to move down to the correct point and the swipe across on the toggle switch for dark mode.
(BTW I'm quite proud of the crudeness of it)
Micky
Re: How to Force Dark Mode?
Posted: 05 Jul 2020 18:37
by Desmanto
Try Control UI in the developer option menu, i got something like this when I click on the "System UI demo mode"
- Developer Options - System UI Mode.png (284.06 KiB) Viewed 17943 times
From there, I can use scrollForwardByld("android:id/title"). I can loop this several times to reach the setting I want.
Of course, this is at my phone. It might be different in other phone/ROM.
Re: How to Force Dark Mode?
Posted: 05 Jul 2020 18:45
by Micky Micky
Lucky you.
Any settings page on my S10 causes the overlay controls to disappear.
Maybe the OP can see it on their phone. If so, then you can help.
Many thanks
Micky