Class: Toybox::System::DeviceSettings

Inherits:
Lang::Object show all

Overview

Represents various settings available on a device.

Examples:

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

See Also:

Since:

  • 1.0.0

Instance Attribute Summary collapse

Method Summary

Methods inherited from Lang::Object

equals, hashCode, method, toString, weak

Instance Attribute Details

activityTrackingOnToybox::Lang::Boolean

The activity tracking setting mode.

Returns:

Since:

  • 1.2.0



9122
9123
9124
# File 'Monkeybrains.rb', line 9122

def activityTrackingOn
  @activityTrackingOn
end

alarmCountToybox::Lang::Number

The number of alarms set on the device.

Returns:

Since:

  • 1.2.0



9111
9112
9113
# File 'Monkeybrains.rb', line 9111

def alarmCount
  @alarmCount
end

connectionAvailableToybox::Lang::Boolean

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

Returns:

Since:

  • 3.0.0



9244
9245
9246
# File 'Monkeybrains.rb', line 9244

def connectionAvailable
  @connectionAvailable
end

connectionInfoToybox::Lang::Dictionary

The state of connections available to the device.

Returns:

  • (Toybox::Lang::Dictionary)

    A Dictionary that contains the state of each available connection. The keys, :bluetooth and :wifi, 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.

Since:

  • 3.0.0



9254
9255
9256
# File 'Monkeybrains.rb', line 9254

def connectionInfo
  @connectionInfo
end

distanceUnitsToybox::Lang::Number

The distance unit setting mode.

Returns:

  • (Toybox::Lang::Number)

    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)

Since:

  • 1.0.0



9071
9072
9073
# File 'Monkeybrains.rb', line 9071

def distanceUnits
  @distanceUnits
end

doNotDisturbToybox::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.

Examples:

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

Returns:

Since:

  • 2.1.0



9137
9138
9139
# File 'Monkeybrains.rb', line 9137

def doNotDisturb
  @doNotDisturb
end

elevationUnitsToybox::Lang::Number

The elevation unit setting mode.

Returns:

  • (Toybox::Lang::Number)

    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)

Since:

  • 1.0.0



9085
9086
9087
# File 'Monkeybrains.rb', line 9085

def elevationUnits
  @elevationUnits
end

firmwareVersionToybox::Lang::Array

The current firmware version of the device.

Examples:

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

Returns:

See Also:

Since:

  • 1.2.0



9207
9208
9209
# File 'Monkeybrains.rb', line 9207

def firmwareVersion
  @firmwareVersion
end

firstDayOfWeekToybox::Lang::Number

The first day of the week.

Returns:

Since:

  • 3.0.0



9259
9260
9261
# File 'Monkeybrains.rb', line 9259

def firstDayOfWeek
  @firstDayOfWeek
end

heightUnitsToybox::Lang::Number

The height unit setting mode.

Returns:

  • (Toybox::Lang::Number)

    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)

Since:

  • 1.0.0



9099
9100
9101
# File 'Monkeybrains.rb', line 9099

def heightUnits
  @heightUnits
end

inputButtonsToybox::Lang::Number

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.

Examples:

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

Returns:

See Also:

Since:

  • 1.2.0



9189
9190
9191
# File 'Monkeybrains.rb', line 9189

def inputButtons
  @inputButtons
end

is24HourToybox::Lang::Boolean

The clock mode mode.

Returns:

  • (Toybox::Lang::Boolean)

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

Since:

  • 1.0.0



9064
9065
9066
# File 'Monkeybrains.rb', line 9064

def is24Hour
  @is24Hour
end

isTouchScreenToybox::Lang::Boolean

The availability of a touch screen on the device.

Returns:

Since:

  • 1.2.0



9171
9172
9173
# File 'Monkeybrains.rb', line 9171

def isTouchScreen
  @isTouchScreen
end

monkeyVersionToybox::Lang::Array

The Connect IQ version supported by the device.

Examples:

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

Returns:

See Also:

Since:

  • 1.2.0



9221
9222
9223
# File 'Monkeybrains.rb', line 9221

def monkeyVersion
  @monkeyVersion
end

notificationCountToybox::Lang::Number

The number of active notifications.

Returns:

Since:

  • 1.2.0



9116
9117
9118
# File 'Monkeybrains.rb', line 9116

def notificationCount
  @notificationCount
end

paceUnitsToybox::Lang::Number

The pace unit setting mode.

Returns:

  • (Toybox::Lang::Number)

    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)

Since:

  • 1.0.0



9078
9079
9080
# File 'Monkeybrains.rb', line 9078

def paceUnits
  @paceUnits
end

partNumberToybox::Lang::String

The part number of the device.

Returns:

Since:

  • 1.2.0



9194
9195
9196
# File 'Monkeybrains.rb', line 9194

def partNumber
  @partNumber
end

phoneConnectedToybox::Lang::Boolean

The phone connection status mode.

Returns:

Since:

  • 1.1.0



9058
9059
9060
# File 'Monkeybrains.rb', line 9058

def phoneConnected
  @phoneConnected
end

screenHeightToybox::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().

Returns:

See Also:

Since:

  • 1.2.0



9165
9166
9167
# File 'Monkeybrains.rb', line 9165

def screenHeight
  @screenHeight
end

screenShapeToybox::Lang::Number

The screen shape of the device.

Returns:

Since:

  • 1.2.0



9143
9144
9145
# File 'Monkeybrains.rb', line 9143

def screenShape
  @screenShape
end

screenWidthToybox::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().

Returns:

See Also:

Since:

  • 1.2.0



9154
9155
9156
# File 'Monkeybrains.rb', line 9154

def screenWidth
  @screenWidth
end

temperatureUnitsToybox::Lang::Number

The temperature unit setting mode.

Returns:

  • (Toybox::Lang::Number)

    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)

Since:

  • 1.0.0



9106
9107
9108
# File 'Monkeybrains.rb', line 9106

def temperatureUnits
  @temperatureUnits
end

tonesOnObject

The tone setting mode. return [Toybox::Lang::Boolean] true if tones are enabled on the device, otherwise false

Since:

  • 1.0.0



9052
9053
9054
# File 'Monkeybrains.rb', line 9052

def tonesOn
  @tonesOn
end

uniqueIdentifierToybox::Lang::String

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.

Examples:

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

Returns:

  • (Toybox::Lang::String)

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

Since:

  • 2.4.1



9239
9240
9241
# File 'Monkeybrains.rb', line 9239

def uniqueIdentifier
  @uniqueIdentifier
end

vibrateOnToybox::Lang::Boolean

The vibration setting mode.

Returns:

Since:

  • 1.0.0



9046
9047
9048
# File 'Monkeybrains.rb', line 9046

def vibrateOn
  @vibrateOn
end

weightUnitsToybox::Lang::Number

The weight unit setting mode.

Returns:

  • (Toybox::Lang::Number)

    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)

Since:

  • 1.0.0



9092
9093
9094
# File 'Monkeybrains.rb', line 9092

def weightUnits
  @weightUnits
end