Announcing Fitbit OS SDK 4.2
chevron down

Announcing Fitbit OS SDK 4.2

Fitbit OS SDK 4.2

We're proud to announce the latest version of the software development kit for Fitbit OS.

This update for the Fitbit OS SDK adds some fantastic capabilities, support for six additional languages, and some enhancements to our existing APIs.

Fitbit OS SDK 4.2 support requires the use of a new Fitbit OS 4.2 firmware update which is now available for all of our smartwatches.

With this release we deprecated SDK 4.0 as we previously described in our deprecation blog post. While existing published projects will continue to work for users, you should now switch to SDK 4.2 for updates, or new projects.

User Activity API: Active Zone Minutes

Active Zone Minutes™ (AZM) now included in Fitbit OS 4.2 is a new and more personalized way to measure your physical activity.

With Fitbit's PurePulse® 24/7 heart rate tracking, AZM uses your personalized heart rate zones to track your effort for any energizing activity. AZM counts minutes spent in each heart rate zone during all activities that get the user's heart pumping. There are 3 heart rate zones which contribute to your AZM during activity: Fat Burn, Cardio and Peak. Depending on the intensity of the activity and the associated heart rate zone a user can earn double minutes.

  • 1 minute in Fat Burn zone = 1 AZM
  • 1 minute in Cardio or Peak zone = 2 AZMs

AZM takes into account recommendations from leading health organizations, including the World Health Organization and the American Heart Association, who recommend getting 150 minutes of moderate or 75 minutes of vigorous activity each week, which has been linked to better overall health and well-being, disease prevention, improved cognitive function, less anxiety and better sleep.

You can find out more about Active Zone Minutes on the Fitbit blog.

The User Activity API contains the user's daily AZM goal value, the individual time spent in each zone, and the total active zone minutes.

When inspecting the time spent in each zone, you must use the local value, but for the total value you should use the adjusted value which matches the Fitbit mobile application.

Let's take a closer look:

import { goals, today } from "user-activity";

console.log(`${} activeZoneMinutes Goal`);

goals.addEventListener("reachgoal", (evt) => {
   if ( ==
     // AZM Goal has been met


Note: Fitbit OS 4.1 was the last firmware release that supported Active Minutes. Developers should now migrate away from using Active Minutes and replace it with the Total Active Zone Minutes.

Support for 6 New Languages!

We've added support for 6 new languages in the device firmware and within the Fitbit App Gallery.

  1. cs-CZ - Czech
  2. id-ID - Indonesian (Bahasa)
  3. pl-PL - Polish
  4. pt-BR - Portuguese (Brazillian)
  5. ro-RO - Romanian
  6. ru-RU - Russian

If you're interested in localizing your applications and clock faces, check out our Localization Guide and i18n sample project on Github.

Double Memory for Versa 2

Developers often joke about downloading more RAM, but by downloading and installing Fitbit OS 4.2 on Versa 2 that's effectively what you've done! We've doubled the allocation from 64K to a whopping 128K!

You can check the availability of this new memory allocation in the existing System API, and use the memorypressurechange event if you need to monitor usage more closely.

import { memory } from "system";

console.log(`JavaScript memory: used=${memory.js.used},
peak=${memory.js.peak}, total=${}`)

memory.monitor.addEventListener('memorypressurechange', () => {
  console.log(`Memory pressure is ${memory.monitor.pressure}`)

Note: Older devices (Fitbit Ionic, Fitbit Versa, Fitbit Versa Lite) cannot receive this additional memory allocation due to their hardware specifications.

Sleep API

Developers can now utilize the on-device sleep classifier to limit specific functionality if the user is determined by the device to be asleep. The new functionality allows developers to receive an event when a user's sleep state changes. The possible states are awake, asleep, or unknown.

Developer's must request the access_sleep permission in order to utilize this new API feature.

Let's take a look:

import sleep from "sleep";
import { me as appbit } from "appbit";

if (sleep && appbit.permissions.granted("access_sleep")) {
  sleep.addEventListener('change', () => {
    console.log(`User sleep state is: ${sleep.state}`);
} else {
  console.log("Sleep API not supported on this device, or permission not

Additional Enhancements

In addition to the new functionality and languages discussed above, we've also added the following:

Scientific.diff() was added to calculate the difference between values in an array. This is the equivalent of Python's numpy.diff().

Scientific.cumsum() was added to calculate the cumulative sum of values in an array, where each value is equal to the sum of all previous values in the array, including the current value. This is the equivalent of Python's numpy.cumsum().

Scientific.clip() was added to constrain the values in an array between min and max. If either min or max is undefined, clipping is not performed on the lower and higher edges respectively. This is the equivalent of Python's numpy.clip().

ActivityHistoryRecord the floors property was renamed to elevationGain to align with our other APIs.

Until Next Time

Follow @fitbitdev on Twitter, and join our Fitbit Community Forum to keep in touch, 24/7. Curious to see the amazing work Fitbit Developers have done so far? Keep tabs on #Made4Fitbit on Twitter.