How to enable NightShift/Night Light/Blue Light Filter programmatically in Android?
Asked Answered
J

0

8

I am trying to enable Blue Light Filter programmatically in Android. Is there any API or function in android that can help me enable / disable / schedule Blue Light Filter option?

For clarification, the feature is called Night Shift in iPhones, Night Light in Google Pixels and Blue Light Filter in Samsung Galaxy. Also there maybe other names. It reduces blue light emitted from screen so that it is less stressful for eyes to look at the screen and helps to sleep.

So far, I have searching on developer.android.com, and I have come across the following:

https://developer.android.com/reference/android/app/UiModeManager

However, when I tried using it on my device which is running on Android 10, and nothing changed. I have found following Questions on Stackoverflow on the API:

To implement Android night mode, using UiModeManager and enable car mode, but show a notification, it may not the good way

Android Night Mode without CarModeEnabled

Android Day/Night Mode. UiModeManafer.getNightMode

How to enable night mode programmatically?

But it discusses about the Night Mode which is actually enabling / disabling dark theme. But what I need is to enable, disable the Blue Light Filter or Night Light, mainly which reduces blue light emitted from the screen. Is there any available API that will allow me to change it?

Jasminjasmina answered 8/9, 2020 at 15:14 Comment(2)
You can see this answer: https://mcmap.net/q/1474066/-how-to-manipulate-screen-color-temperature-in-android-like-f-lux This should help.Hubris
That was before everybody and their aunt implemented night light. Certainly there must be an intent or something to handle this built-in feature?Graz

© 2022 - 2025 — McMap. All rights reserved.