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

此生再无相见时 提交于 2020-12-13 04:05:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!