问题
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?
来源:https://stackoverflow.com/questions/63796825/how-to-enable-nightshift-night-light-blue-light-filter-programmatically-in-andro