Android Guides | Samples

Android.App.UiModeManager Class

This class provides access to the system uimode services.

See Also: UiModeManager

Syntax

[Android.Runtime.Register("android/app/UiModeManager", DoNotGenerateAcw=true)]
public class UiModeManager : Object

Remarks

This class provides access to the system uimode services. These services allow applications to control UI modes of the device. It provides functionality to disable the car mode and it gives access to the night mode settings.

These facilities are built on top of the underlying Intent.ActionDockEvent broadcasts that are sent when the user physical places the device into and out of a dock. When that happens, the UiModeManager switches the system Configuration to the appropriate UI mode, sends broadcasts about the mode switch, and starts the corresponding mode activity if appropriate. See the broadcasts UiModeManager.ActionEnterCarMode and UiModeManager.ActionEnterDeskMode for more information.

In addition, the user may manually switch the system to car mode without physically being in a dock. While in car mode -- whether by manual action from the user or being physically placed in a dock -- a notification is displayed allowing the user to exit dock mode. Thus the dock mode represented here may be different than the current state of the underlying dock event broadcast.

You do not instantiate this class directly; instead, retrieve it through Context.GetSystemService(String).

[Android Documentation]

Requirements

Namespace: Android.App
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 8

The members of Android.App.UiModeManager are listed below.

See Also: Object

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Fields

const
DisableCarModeGoHomeDisableCarModeFlags (1). Flag for use with UiModeManager.DisableCarMode(DisableCarModeFlags): go to the normal home activity as part of the disable.
const
EnableCarModeAllowSleepEnableCarModeFlags (2). Flag for use with UiModeManager.EnableCarMode(EnableCarModeFlags): allow sleep mode while in car mode.
const
EnableCarModeGoCarHomeEnableCarModeFlags (1). Flag for use with UiModeManager.EnableCarMode(EnableCarModeFlags): go to the car home activity as part of the enable.
const
ModeNightAutoUiNightMode (0). Constant for UiModeManager.NightMode and UiModeManager.NightMode: automatically switch night mode on and off based on the time.
const
ModeNightNoUiNightMode (1). Constant for UiModeManager.NightMode and UiModeManager.NightMode: never run in night mode.
const
ModeNightYesUiNightMode (2). Constant for UiModeManager.NightMode and UiModeManager.NightMode: always run in night mode.

Public Properties

static
ActionEnterCarModeString. Broadcast sent when the device's UI has switched to car mode, either by being placed in a car dock or explicit action of the user.
static
ActionEnterDeskModeString. Broadcast sent when the device's UI has switched to desk mode, by being placed in a desk dock.
static
ActionExitCarModeString. Broadcast sent when the device's UI has switch away from car mode back to normal mode.
static
ActionExitDeskModeString. Broadcast sent when the device's UI has switched away from desk mode back to normal mode.
[read-only]
CurrentModeTypeUiMode. Return the current running mode type.
NightModeUiNightMode.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

DisableCarMode(DisableCarModeFlags)
Turn off special mode if currently in car mode.
EnableCarMode(EnableCarModeFlags)
Force device into car mode, like it had been placed in the car dock.
static
FromContext(Context) : UiModeManager