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


9623
9624
9625
# File 'Monkeybrains.rb', line 9623

def activityTrackingOn
  @activityTrackingOn
end

alarmCountToybox::Lang::Number

The number of alarms set on the device.

Returns:

Since:

  • 1.2.0


9612
9613
9614
# File 'Monkeybrains.rb', line 9612

def alarmCount
  @alarmCount
end

connectionAvailableToybox::Lang::Boolean

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

Returns:

Since:

  • 3.0.0


9745
9746
9747
# File 'Monkeybrains.rb', line 9745

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


9755
9756
9757
# File 'Monkeybrains.rb', line 9755

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


9572
9573
9574
# File 'Monkeybrains.rb', line 9572

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


9638
9639
9640
# File 'Monkeybrains.rb', line 9638

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


9586
9587
9588
# File 'Monkeybrains.rb', line 9586

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


9708
9709
9710
# File 'Monkeybrains.rb', line 9708

def firmwareVersion
  @firmwareVersion
end

firstDayOfWeekToybox::Lang::Number

The first day of the week.

Returns:

Since:

  • 3.0.0


9760
9761
9762
# File 'Monkeybrains.rb', line 9760

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


9600
9601
9602
# File 'Monkeybrains.rb', line 9600

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


9690
9691
9692
# File 'Monkeybrains.rb', line 9690

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


9565
9566
9567
# File 'Monkeybrains.rb', line 9565

def is24Hour
  @is24Hour
end

isTouchScreenToybox::Lang::Boolean

The availability of a touch screen on the device.

Returns:

Since:

  • 1.2.0


9672
9673
9674
# File 'Monkeybrains.rb', line 9672

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


9722
9723
9724
# File 'Monkeybrains.rb', line 9722

def monkeyVersion
  @monkeyVersion
end

notificationCountToybox::Lang::Number

The number of active notifications.

Returns:

Since:

  • 1.2.0


9617
9618
9619
# File 'Monkeybrains.rb', line 9617

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


9579
9580
9581
# File 'Monkeybrains.rb', line 9579

def paceUnits
  @paceUnits
end

partNumberToybox::Lang::String

The part number of the device.

Returns:

Since:

  • 1.2.0


9695
9696
9697
# File 'Monkeybrains.rb', line 9695

def partNumber
  @partNumber
end

phoneConnectedToybox::Lang::Boolean

The phone connection status mode.

Returns:

Since:

  • 1.1.0


9559
9560
9561
# File 'Monkeybrains.rb', line 9559

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


9666
9667
9668
# File 'Monkeybrains.rb', line 9666

def screenHeight
  @screenHeight
end

screenShapeToybox::Lang::Number

The screen shape of the device.

Returns:

Since:

  • 1.2.0


9644
9645
9646
# File 'Monkeybrains.rb', line 9644

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


9655
9656
9657
# File 'Monkeybrains.rb', line 9655

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


9607
9608
9609
# File 'Monkeybrains.rb', line 9607

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


9553
9554
9555
# File 'Monkeybrains.rb', line 9553

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


9740
9741
9742
# File 'Monkeybrains.rb', line 9740

def uniqueIdentifier
  @uniqueIdentifier
end

vibrateOnToybox::Lang::Boolean

The vibration setting mode.

Returns:

Since:

  • 1.0.0


9547
9548
9549
# File 'Monkeybrains.rb', line 9547

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


9593
9594
9595
# File 'Monkeybrains.rb', line 9593

def weightUnits
  @weightUnits
end