Class: Toybox.System.DeviceSettings

Overview

Represents various settings available on a device.

See Also:

Example:

using Toybox.System;
var mySettings = System.getDeviceSettings();
var clockMode = mySettings.is24Hour;
var phone = mySettings.phoneConnected;
var version = mySettings.monkeyVersion;
var versionString = Lang.format("$1$.$2$.$3$", version);
System.println(versionString); //e.g. 2.2.5

Since:

API Level 1.0.0

Instance Member Summary collapse

Instance Attribute Details

var activityTrackingOn as Lang.Boolean

The activity tracking setting mode.

Since:

API Level 1.2.0

Returns:

  • Lang.Boolean

    true if activity tracking is enabled on the device, otherwise false

var alarmCount as Lang.Number

The number of alarms set on the device.

Since:

API Level 1.2.0

Returns:

var connectionAvailable as Lang.Boolean

Indicates if any communication channel is connected and available for use.

Since:

API Level 3.0.0

Returns:

var connectionInfo as Lang.Dictionary<Lang.Symbol, System.ConnectionInfo>

The state of connections available to the device.

Since:

API Level 3.0.0

Returns:

  • Lang.Dictionary

    A Dictionary that contains the state of each available connection. The keys, :bluetooth, :wifi, and :lte indicate the connection type. If a key is not present then it means that connection type is not available to the device. The values are a ConnectionInfo object, which contain the state of the connection type.

var distanceUnits as System.UnitsSystem

The distance unit setting mode.

Since:

API Level 1.0.0

Returns:

  • System.UnitsSystem

    One of two System.UNIT_* constant values:

    • UNIT_METRIC if distance is set to display in kilometers (km)

    • UNIT_STATUTE if distance is set to display in miles (mi)

var doNotDisturb as Lang.Boolean

The Do Not Disturb setting mode.

Not all devices support Do Not Disturb, so it's a good idea to perform a has check when attempting to use this value.

Example:

using Toybox.System;
var mySettings = System.getDeviceSettings();
if (deviceSettings has :doNotDisturb) {
    var doNotDisturb = deviceSettings.doNotDisturb;
}

Since:

API Level 2.1.0

Returns:

  • Lang.Boolean

    true if enabled on the device, otherwise false

var elevationUnits as System.UnitsSystem

The elevation unit setting mode.

Since:

API Level 1.0.0

Returns:

  • System.UnitsSystem

    One of two System.UNIT_* constant values:

    • UNIT_METRIC if elevation is set to display in meters (m)

    • UNIT_STATUTE if elevation is set to display in feet (ft)

var firmwareVersion as [ Lang.Number, Lang.Number ]

The current firmware version of the device.

Example:

using Toybox.System;
var mySettings = System.getDeviceSettings();
var version = mySettings.firmwareVersion;
var versionString = Lang.format("$1$.$2$", version);
System.println(versionString minor); // e.g. 2.50

Since:

API Level 1.2.0

See Also:

Returns:

  • Lang.Array

    A two element Array containing the major and minor version numbers as Number objects

var firstDayOfWeek as Gregorian.DayOfWeek

The first day of the week.

Since:

API Level 3.0.0

Returns:

var fontScale as Lang.Float

Scale factor to be used for displayed text.

Since:

API Level 5.0.1

Supported Devices:

Returns:

  • Lang.Float

    Scaling factor configured by user. Values will always be positive, and are typically in the range of 0.8 to 1.2.

var heightUnits as System.UnitsSystem

The height unit setting mode.

Since:

API Level 1.0.0

Returns:

  • System.UnitsSystem

    One of two UNIT_* constant values:

    • UNIT_METRIC if height is set to display in meters (m)

    • UNIT_STATUTE if height is set to display inSystem. feet (ft)

var inputButtons as System.ButtonInputs

The physical buttons supported by the device.

This returns a bitwise binary of the enumerated values defined by the System.BUTTON_INPUT_* constants that match the available buttons on a particular device. For example, a vivoactive HR returns a value of 9, which indicates Select (1) and Menu (8) button support. A fenix 5, however, returns 11, indicating support for all available button types.

Example:

using Toybox.System;
var mySettings = System.getDeviceSettings();
if ((mySettings.inputButtons & System.BUTTON_INPUT_MENU) != 0) {
    // Allow the use of the Menu button
}

Since:

API Level 1.2.0

See Also:

Returns:

var is24Hour as Lang.Boolean

The clock mode mode.

Since:

API Level 1.0.0

Returns:

  • Lang.Boolean

    true if the device is set to 24 hour mode, false if it is set to 12 hour mode

var isEnhancedReadabilityModeEnabled as Lang.Boolean

Indicates the device is currently using Enhanced Readability Mode.

Since:

API Level 4.2.3

Supported Devices:

Returns:

  • Lang.Boolean

    true if Enhanced Readability Mode is enabled, otherwise false.

var isGlanceModeEnabled as Lang.Boolean

Indicates if widget glances are enabled on the device.

If glance mode is enabled, the system will pass up / down key events to a widget base page. Otherwise, the system will mask them out.

Since:

API Level 3.1.4

Supported Devices:

Returns:

  • Lang.Boolean

    true if glance mode is enabled, otherwise false

var isNightModeEnabled as Lang.Boolean

Indicates the device is currently using night mode colors

Since:

API Level 4.1.2

Supported Devices:

Returns:

  • Lang.Boolean

    true if night colors are currently in use, otherwise false.

var isTouchScreen as Lang.Boolean

The availability of a touch screen on the device.

Since:

API Level 1.2.0

Returns:

  • Lang.Boolean

    true if the device has a touch screen and it is enabled in settings, otherwise false

var monkeyVersion as [ Lang.Number, Lang.Number, Lang.Number ]

The Connect IQ version supported by the device.

Example:

using Toybox.System;
var mySettings = System.getDeviceSettings();
var version = mySettings.monkeyVersion;
var versionString = Lang.format("$1$.$2$.$3$", version);
System.println(versionString); //e.g. 2.2.5

Since:

API Level 1.2.0

See Also:

Returns:

  • Lang.Array

    A three element Array containing the major, minor, and micro version numbers as Number objects

var notificationCount as Lang.Number

The number of active notifications.

Since:

API Level 1.2.0

Returns:

var paceUnits as System.UnitsSystem

The pace unit setting mode.

Since:

API Level 1.0.0

Returns:

  • System.UnitsSystem

    One of two System.UNIT_* constant values:

    • UNIT_METRIC if pace is set to display in kilometers per hour (km/hr)

    • UNIT_STATUTE if pace is set to display in miles per hour (mph)

var partNumber as Lang.String

The part number of the device.

Since:

API Level 1.2.0

Returns:

var phoneConnected as Lang.Boolean

The phone connection status mode.

Since:

API Level 1.1.0

Returns:

  • Lang.Boolean

    true if a mobile phone is connected to the device, otherwise false

var requiresBurnInProtection as Lang.Boolean

This flag indicates whether the device screen requires burn-in protection.

Some screens require special drawing behavior when rendering content in always-on mode. If a screen requires burn-in protection the following rules must be followed: A maximum of ten-percent of the total available screen pixels can be in use at one time. Individual pixels can be on for no more than three update cycles when updating at once-per-minute intervals. If either condition is violated all screen pixels will be turned off until the device goes into high-power mode.

Since:

API Level 3.0.12

Returns:

  • Lang.Boolean

    true if the screen type needs burn-in protection, false otherwise.

var screenHeight as Lang.Number

The height of the device screen in pixels.

In some cases, this can be useful to determine the device type at runtime. However, to get the height of the screen area currently available to an app, use Graphics.Dc.getHeight().

Since:

API Level 1.2.0

See Also:

Returns:

var screenShape as System.ScreenShape

The screen shape of the device.

Since:

API Level 1.2.0

Returns:

var screenWidth as Lang.Number

The width of the device screen in pixels.

In some cases, this can be useful to determine the device type at runtime. However, to get the width of the screen area currently available to an app, use Graphics.Dc.getWidth().

Since:

API Level 1.2.0

See Also:

Returns:

var systemLanguage as System.Language

The language being used by the system

Since:

API Level 3.1.0

Returns:

var temperatureUnits as System.UnitsSystem

The temperature unit setting mode.

Since:

API Level 1.0.0

Returns:

  • System.UnitsSystem

    One of two System.UNIT_* constant values:

    • UNIT_METRIC if temperature is set to display in degrees Celsius (C)

    • UNIT_STATUTE if temperature is set to display in degrees Fahrenheit (F)

var tonesOn as Lang.Boolean

The tone setting mode.

Since:

API Level 1.0.0

Returns:

  • Lang.Boolean

    true if tones are enabled on the device, otherwise false

var uniqueIdentifier as Lang.String or Null

A unique alphanumeric device identifier.

The value is unique for every app, but is stable on a device across uninstall and reinstall. Any use of this value for tracking user information must be in compliance with international privacy law.

Example:

using Toybox.System;
var mySettings = System.getDeviceSettings();
var id = mySettings.uniqueIdentifier;
if (id != null) {
    System.println(id); //e.g. ac915d426451c88e8ea691fa412f9af9c21b4d12
}

Since:

API Level 2.4.1

Returns:

  • Lang.String

    An identifier that can be used to identify the host device or null on error.

var vibrateOn as Lang.Boolean

The vibration setting mode.

Since:

API Level 1.0.0

Returns:

  • Lang.Boolean

    true if vibration is enabled on the device, otherwise false

var weightUnits as System.UnitsSystem

The weight unit setting mode.

Since:

API Level 1.0.0

Returns:

  • System.UnitsSystem

    One of two System.UNIT_* constant values:

    • UNIT_METRIC if weight is set to display in kilograms (kg)

    • UNIT_STATUTE if weight is set to display in pounds (lbs)


Generated Sep 23, 2024, 3:32:49 PM