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


10932
10933
10934
# File 'Monkeybrains.rb', line 10932

def activityTrackingOn
  @activityTrackingOn
end

alarmCountToybox::Lang::Number

The number of alarms set on the device.

Returns:

Since:

  • 1.2.0


10921
10922
10923
# File 'Monkeybrains.rb', line 10921

def alarmCount
  @alarmCount
end

connectionAvailableToybox::Lang::Boolean

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

Returns:

Since:

  • 3.0.0


11054
11055
11056
# File 'Monkeybrains.rb', line 11054

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


11064
11065
11066
# File 'Monkeybrains.rb', line 11064

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


10881
10882
10883
# File 'Monkeybrains.rb', line 10881

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


10947
10948
10949
# File 'Monkeybrains.rb', line 10947

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


10895
10896
10897
# File 'Monkeybrains.rb', line 10895

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


11017
11018
11019
# File 'Monkeybrains.rb', line 11017

def firmwareVersion
  @firmwareVersion
end

firstDayOfWeekToybox::Lang::Number

The first day of the week.

Returns:

Since:

  • 3.0.0


11069
11070
11071
# File 'Monkeybrains.rb', line 11069

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


10909
10910
10911
# File 'Monkeybrains.rb', line 10909

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


10999
11000
11001
# File 'Monkeybrains.rb', line 10999

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


10874
10875
10876
# File 'Monkeybrains.rb', line 10874

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


11096
11097
11098
# File 'Monkeybrains.rb', line 11096

def isGlanceModeEnabled
  @isGlanceModeEnabled
end

isTouchScreenToybox::Lang::Boolean

The availability of a touch screen on the device.

Returns:

Since:

  • 1.2.0


10981
10982
10983
# File 'Monkeybrains.rb', line 10981

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


11031
11032
11033
# File 'Monkeybrains.rb', line 11031

def monkeyVersion
  @monkeyVersion
end

notificationCountToybox::Lang::Number

The number of active notifications.

Returns:

Since:

  • 1.2.0


10926
10927
10928
# File 'Monkeybrains.rb', line 10926

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


10888
10889
10890
# File 'Monkeybrains.rb', line 10888

def paceUnits
  @paceUnits
end

partNumberToybox::Lang::String

The part number of the device.

Returns:

Since:

  • 1.2.0


11004
11005
11006
# File 'Monkeybrains.rb', line 11004

def partNumber
  @partNumber
end

phoneConnectedToybox::Lang::Boolean

The phone connection status mode.

Returns:

Since:

  • 1.1.0


10868
10869
10870
# File 'Monkeybrains.rb', line 10868

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


11081
11082
11083
# File 'Monkeybrains.rb', line 11081

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


10975
10976
10977
# File 'Monkeybrains.rb', line 10975

def screenHeight
  @screenHeight
end

screenShapeToybox::Lang::Number

The screen shape of the device.

Returns:

Since:

  • 1.2.0


10953
10954
10955
# File 'Monkeybrains.rb', line 10953

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


10964
10965
10966
# File 'Monkeybrains.rb', line 10964

def screenWidth
  @screenWidth
end

systemLanguageToybox::Lang::Number

The language being used by the system

Returns:

Since:

  • 3.1.0


11087
11088
11089
# File 'Monkeybrains.rb', line 11087

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


10916
10917
10918
# File 'Monkeybrains.rb', line 10916

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


10862
10863
10864
# File 'Monkeybrains.rb', line 10862

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


11049
11050
11051
# File 'Monkeybrains.rb', line 11049

def uniqueIdentifier
  @uniqueIdentifier
end

vibrateOnToybox::Lang::Boolean

The vibration setting mode.

Returns:

Since:

  • 1.0.0


10856
10857
10858
# File 'Monkeybrains.rb', line 10856

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


10902
10903
10904
# File 'Monkeybrains.rb', line 10902

def weightUnits
  @weightUnits
end