I'm implementing to change the theme of the app depending on whether it's day or night, with NightMode
of Android
I have defined the two themes, day and night, that work correctly
To activate the dark / night
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
To activate the clearing / day
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
But when specifying to activate the light or dark depending on the time of the system, with the value MODE_NIGHT_AUTO
never activates at night.
In the log I receive
Could not get last known location. This is probably because of the app does not have any location permissions. Falling back to hardcoded sunrise / sunset values