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


10929
10930
10931
# File 'Monkeybrains.rb', line 10929

def activityTrackingOn
  @activityTrackingOn
end

alarmCountToybox::Lang::Number

The number of alarms set on the device.

Returns:

Since:

  • 1.2.0


10918
10919
10920
# File 'Monkeybrains.rb', line 10918

def alarmCount
  @alarmCount
end

connectionAvailableToybox::Lang::Boolean

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

Returns:

Since:

  • 3.0.0


11051
11052
11053
# File 'Monkeybrains.rb', line 11051

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

Since:

  • 3.0.0


11061
11062
11063
# File 'Monkeybrains.rb', line 11061

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


10878
10879
10880
# File 'Monkeybrains.rb', line 10878

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


10944
10945
10946
# File 'Monkeybrains.rb', line 10944

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


10892
10893
10894
# File 'Monkeybrains.rb', line 10892

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


11014
11015
11016
# File 'Monkeybrains.rb', line 11014

def firmwareVersion
  @firmwareVersion
end

firstDayOfWeekToybox::Lang::Number

The first day of the week.

Returns:

Since:

  • 3.0.0


11066
11067
11068
# File 'Monkeybrains.rb', line 11066

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


10906
10907
10908
# File 'Monkeybrains.rb', line 10906

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


10996
10997
10998
# File 'Monkeybrains.rb', line 10996

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


10871
10872
10873
# File 'Monkeybrains.rb', line 10871

def is24Hour
  @is24Hour
end

isGlanceModeEnabledToybox::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's base page. Otherwise, the system will mask them out.

Returns:

Since:

  • 3.1.4


11093
11094
11095
# File 'Monkeybrains.rb', line 11093

def isGlanceModeEnabled
  @isGlanceModeEnabled
end

isTouchScreenToybox::Lang::Boolean

The availability of a touch screen on the device.

Returns:

Since:

  • 1.2.0


10978
10979
10980
# File 'Monkeybrains.rb', line 10978

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


11028
11029
11030
# File 'Monkeybrains.rb', line 11028

def monkeyVersion
  @monkeyVersion
end

notificationCountToybox::Lang::Number

The number of active notifications.

Returns:

Since:

  • 1.2.0


10923
10924
10925
# File 'Monkeybrains.rb', line 10923

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


10885
10886
10887
# File 'Monkeybrains.rb', line 10885

def paceUnits
  @paceUnits
end

partNumberToybox::Lang::String

The part number of the device.

Returns:

Since:

  • 1.2.0


11001
11002
11003
# File 'Monkeybrains.rb', line 11001

def partNumber
  @partNumber
end

phoneConnectedToybox::Lang::Boolean

The phone connection status mode.

Returns:

Since:

  • 1.1.0


10865
10866
10867
# File 'Monkeybrains.rb', line 10865

def phoneConnected
  @phoneConnected
end

requiresBurnInProtectionToybox::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. false otherwise.

Returns:

Since:

  • 3.0.12


11078
11079
11080
# File 'Monkeybrains.rb', line 11078

def requiresBurnInProtection
  @requiresBurnInProtection
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


10972
10973
10974
# File 'Monkeybrains.rb', line 10972

def screenHeight
  @screenHeight
end

screenShapeToybox::Lang::Number

The screen shape of the device.

Returns:

Since:

  • 1.2.0


10950
10951
10952
# File 'Monkeybrains.rb', line 10950

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


10961
10962
10963
# File 'Monkeybrains.rb', line 10961

def screenWidth
  @screenWidth
end

systemLanguageToybox::Lang::Number

The language being used by the system

Returns:

Since:

  • 3.1.0


11084
11085
11086
# File 'Monkeybrains.rb', line 11084

def systemLanguage
  @systemLanguage
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


10913
10914
10915
# File 'Monkeybrains.rb', line 10913

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


10859
10860
10861
# File 'Monkeybrains.rb', line 10859

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


11046
11047
11048
# File 'Monkeybrains.rb', line 11046

def uniqueIdentifier
  @uniqueIdentifier
end

vibrateOnToybox::Lang::Boolean

The vibration setting mode.

Returns:

Since:

  • 1.0.0


10853
10854
10855
# File 'Monkeybrains.rb', line 10853

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


10899
10900
10901
# File 'Monkeybrains.rb', line 10899

def weightUnits
  @weightUnits
end