prompteus
prompteus

Reputation: 1032

Android DayNight MODE_NIGHT_AUTO vs MODE_NIGHT_FOLLOW_SYSTEM

I've read this article: https://medium.com/@chrisbanes/appcompat-v23-2-daynight-d10f90c83e94. It mentions DayNight theme and then:

Then you need to enable the feature in your app. You do that by calling AppCompatDelegate.setDefaultNightMode() which takes one of four values:

  • MODE_NIGHT_NO. Always use the day (light) theme.
  • MODE_NIGHT_YES. Always use the night (dark) theme.
  • MODE_NIGHT_AUTO. Changes between day/night based on the time of day.
  • MODE_NIGHT_FOLLOW_SYSTEM (default). This setting follows the system’s setting, which is essentially MODE_NIGHT_NO at the time of writing

Scenario is simple: The app toggles the night mode automatically without in-app settings.

  1. Would I use MODE_NIGHT_AUTO or MODE_NIGHT_FOLLOW_SYSTEM?
  2. How do they compare in different versions of Android?
  3. What are the advantages and disadvantages of both of them (I can think of consistency issues between apps...)?

Upvotes: 4

Views: 1866

Answers (1)

Pauland
Pauland

Reputation: 2014

I think the good answer is:

Advantage of

MODE_NIGHT_NO, MODE_NIGHT_YES, MODE_NIGHT_AUTO

will always ignore user/device settings. You can set nigthmode enable in your app while nigthmode is totally disabled by user on device.

Advantage of

MODE_NIGHT_FOLLOW_SYSTEM

can be equivalent to MODE_NIGHT_NO, MODE_NIGHT_YES, MODE_NIGHT_AUTO, the user choice for all apps by the user on the device.

Upvotes: 0

Related Questions