User-profile API
chevron down
 

User-profile API

Variable: user

Type: UserProfile

The User Profile API provides information related to the user account of the device. Requires the access_user_profile permission.

import { me as appbit } from "appbit";
import { user } from "user-profile";

if (appbit.permissions.granted("access_user_profile")) {
   console.log((user.restingHeartRate || "Unknown") + " BPM");
}

Interface: UserProfile

Properties for values that are not available (because they are unknown or the application does not have the permission to access them) have the value undefined.

Properties

readonly age

number or undefined

User's age in years.

readonly bmr

number or undefined

User's basal metabolic rate in kcal/day.

readonly gender

"male" or "female" or undefined

User's gender.

readonly height

number or undefined

User's height in meters.

readonly maxHeartRate

number or undefined

New in SDK 5.0

User's maximum theoretical heart rate in bpm (beats per minute), based on their profile settings.

Note: There is no guarantee that the user's heart rate will reach, or exceed this value. This a theoretical value based on medical research and can also be adjusted by the user. It is entirely possible that the user's heart rate could exceed a maxHeartRate value defined by the user.

readonly restingHeartRate

number or undefined

User's resting heart rate in bpm (beats per minute).

readonly stride

{ readonly walk: number or undefined; readonly run: number or undefined; }

User's stride

readonly weight

number or undefined

User's weight in kilograms.

Methods

heartRateZone()

heartRateZone(heartRate: number)

Returns: "out-of-range" or "fat-burn" or "cardio" or "peak" or "below-custom" or "custom" or "above-custom"

Get the heart rate zone for a given heart rate.

When the user has not configured a custom zone, the possible values are, in order of increasing heart rate:

  • "out-of-range" when the heart rate is below the "Fat Burn" zone.
  • "fat-burn" when the heart rate is in the "Fat Burn" zone.
  • "cardio" when the heart rate is in the "Cardio" zone.
  • "peak" when the heart rate is above the "Cardio" zone.

When the user has configured a custom zone, the possible values are, in order of increasing heart rate:

  • "below-custom" when the heart rate is below the custom zone.
  • "custom" when the heart rate is in the custom zone.
  • "above-custom" when the heart rate is above the custom zone.

Parameter: heartRate Heart rate for which the zone should be returned.