Module: Toybox::UserProfile

Overview

The UserProfile module will allow apps to access user information.

The module contains the GENDER_* enum to retrieve gender information from the user profile. The HR_ZONE_SPORT_* enum also provides constants for defining different sport type. This is used to retrieve Heart Rate Zones specific to that sport.

Examples:

Simple UserProfile module use

using Toybox.UserProfile;

var profile = UserProfile.getProfile();
System.out.println("The user was born in " + profile.birthYear);

Since:

  • 1.0.0

Requires Permission:

  • UserProfile

Defined Under Namespace

Classes: Profile

Constant Summary

GENDER_FEMALE = 0

Since:

  • 1.0.0

GENDER_MALE = 1

Since:

  • 1.0.0

HR_ZONE_SPORT_GENERIC = 0

Since:

  • 1.2.6

HR_ZONE_SPORT_RUNNING = 1

Since:

  • 1.2.6

HR_ZONE_SPORT_BIKING = 2

Since:

  • 1.2.6

HR_ZONE_SPORT_SWIMMING = 3

Since:

  • 1.2.6

Instance Method Summary collapse

Instance Method Details

getCurrentSportToybox::Lang::Number

Return the sport for which the current activity retrieves heart rate zone thresholds.

If the active sport does not have sport specific zones, it will return HR_ZONE_SPORT_GENERIC.

Examples:

using Toybox.UserProfile;
var profile = UserProfile.getCurrentSport();

Returns:

Since:

  • 1.2.6


12643
12644
# File 'Monkeybrains.rb', line 12643

def getCurrentSport()
end

getHeartRateZones(sport) ⇒ Toybox::Lang::Array

Retrieve an Array of the current heart rate zone threshold values in beats per minute (bpm)

The returned Array contains zone values as follows:

* min zone 1 - The minimum heart rate threshold for zone 1
* max zone 1 - The maximum heart rate threshold for zone 1
* max zone 2 - The maximum heart rate threshold for zone 2
* max zone 3 - The maximum heart rate threshold for zone 3
* max zone 4 - The maximum heart rate threshold for zone 4
* max zone 5 - The maximum heart rate threshold for zone 5

Examples:

Use the HR_ZONE_SPORT_* enum to get the zone for that specific sport

using Toybox.UserProfile;
var genericZoneInfo = UserProfile.getHeartRateZones(UserProfile.HR_ZONE_SPORT_GENERIC);

Parameters:

Returns:

Since:

  • 1.2.6


12629
12630
# File 'Monkeybrains.rb', line 12629

def getHeartRateZones(sport)
end

getProfileToybox::UserProfile::Profile

Retrieve the current UserProfile.Profile object.

Examples:

using Toybox.UserProfile;
var profile = UserProfile.getProfile();

Returns:

Since:

  • 1.0.0


12608
12609
# File 'Monkeybrains.rb', line 12608

def getProfile()
end