Language

UiModeManager.SetApplicationNightMode(Int32) Method

Definition

Sets and persist the night mode for this application.

[Android.Runtime.Register("setApplicationNightMode", "(I)V", "GetSetApplicationNightMode_IHandler", ApiSince=31)]
public virtual void SetApplicationNightMode(int mode);
[<Android.Runtime.Register("setApplicationNightMode", "(I)V", "GetSetApplicationNightMode_IHandler", ApiSince=31)>]
abstract member SetApplicationNightMode : int -> unit
override this.SetApplicationNightMode : int -> unit

Parameters

mode
Int32

int: the night mode to set. Value is one of the following: MODE_NIGHT_AUTO MODE_NIGHT_CUSTOM MODE_NIGHT_NO MODE_NIGHT_YES

Attributes

Remarks

Sets and persist the night mode for this application. The mode can be one of: MODE_NIGHT_NO sets the device into notnight mode MODE_NIGHT_YES sets the device into night mode MODE_NIGHT_CUSTOM automatically switches between night and notnight based on the custom time set (or default) MODE_NIGHT_AUTO automatically switches between night and notnight based on the device's current location and certain other sensors Changes to night mode take effect locally and will result in a configuration change (and potentially an Activity lifecycle event) being applied to this application. The mode is persisted for this application until it is either modified by the application, the user clears the data for the application, or this application is uninstalled. Developers interested in a non-persistent app-local implementation of night mode should consider using AppCompatDelegate.setDefaultNightMode(int) to manage the -night qualifier locally.

See also:

Android reference for android.app.UiModeManager.setApplicationNightMode.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to