https://programmerworld.co/android/how-to-detect-ambient-light-bright-dark-or-day-night-and-set-the-layout-background-accordingly-in-your-android-app/
How to detect Ambient Light (Bright/Dark or Day/Night) and set the layout background accordingly in your Android App?