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


9366
9367
9368
# File 'Monkeybrains.rb', line 9366

def activityTrackingOn
  @activityTrackingOn
end

alarmCountToybox::Lang::Number

The number of alarms set on the device.

Returns:

Since:

  • 1.2.0


9355
9356
9357
# File 'Monkeybrains.rb', line 9355

def alarmCount
  @alarmCount
end

connectionAvailableToybox::Lang::Boolean

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

Returns:

Since:

  • 3.0.0


9488
9489
9490
# File 'Monkeybrains.rb', line 9488

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


9498
9499
9500
# File 'Monkeybrains.rb', line 9498

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


9315
9316
9317
# File 'Monkeybrains.rb', line 9315

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


9381
9382
9383
# File 'Monkeybrains.rb', line 9381

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


9329
9330
9331
# File 'Monkeybrains.rb', line 9329

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


9451
9452
9453
# File 'Monkeybrains.rb', line 9451

def firmwareVersion
  @firmwareVersion
end

firstDayOfWeekToybox::Lang::Number

The first day of the week.

Returns:

Since:

  • 3.0.0


9503
9504
9505
# File 'Monkeybrains.rb', line 9503

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


9343
9344
9345
# File 'Monkeybrains.rb', line 9343

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


9433
9434
9435
# File 'Monkeybrains.rb', line 9433

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


9308
9309
9310
# File 'Monkeybrains.rb', line 9308

def is24Hour
  @is24Hour
end

isTouchScreenToybox::Lang::Boolean

The availability of a touch screen on the device.

Returns:

Since:

  • 1.2.0


9415
9416
9417
# File 'Monkeybrains.rb', line 9415

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


9465
9466
9467
# File 'Monkeybrains.rb', line 9465

def monkeyVersion
  @monkeyVersion
end

notificationCountToybox::Lang::Number

The number of active notifications.

Returns:

Since:

  • 1.2.0


9360
9361
9362
# File 'Monkeybrains.rb', line 9360

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


9322
9323
9324
# File 'Monkeybrains.rb', line 9322

def paceUnits
  @paceUnits
end

partNumberToybox::Lang::String

The part number of the device.

Returns:

Since:

  • 1.2.0


9438
9439
9440
# File 'Monkeybrains.rb', line 9438

def partNumber
  @partNumber
end

phoneConnectedToybox::Lang::Boolean

The phone connection status mode.

Returns:

Since:

  • 1.1.0


9302
9303
9304
# File 'Monkeybrains.rb', line 9302

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


9409
9410
9411
# File 'Monkeybrains.rb', line 9409

def screenHeight
  @screenHeight
end

screenShapeToybox::Lang::Number

The screen shape of the device.

Returns:

Since:

  • 1.2.0


9387
9388
9389
# File 'Monkeybrains.rb', line 9387

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


9398
9399
9400
# File 'Monkeybrains.rb', line 9398

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


9350
9351
9352
# File 'Monkeybrains.rb', line 9350

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


9296
9297
9298
# File 'Monkeybrains.rb', line 9296

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


9483
9484
9485
# File 'Monkeybrains.rb', line 9483

def uniqueIdentifier
  @uniqueIdentifier
end

vibrateOnToybox::Lang::Boolean

The vibration setting mode.

Returns:

Since:

  • 1.0.0


9290
9291
9292
# File 'Monkeybrains.rb', line 9290

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


9336
9337
9338
# File 'Monkeybrains.rb', line 9336

def weightUnits
  @weightUnits
end