I want to have to battery level update in my clockface constantly, like every minute or so. It currently refreshes only when I go back to the clock face from another app, and there is a noticeable delay.
This is the code I have:
const batteryHandle = document.getElementById("batteryLabel");
batteryHandle.text = `${battery.chargeLevel} `;
Any suggestions?
Answered! Go to the Best Answer.
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
Yeah, something like
import clock from "clock";
import { battery } from "power";
const batteryHandle = document.getElementById("batteryLabel");
clock.granularity = "minutes"; // seconds, minutes, or hours
clock.addEventListener("tick", (evt) => {
// tick every minute
batteryHandle.text = `${battery.chargeLevel} `;
});
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
Yeah, something like
import clock from "clock";
import { battery } from "power";
const batteryHandle = document.getElementById("batteryLabel");
clock.granularity = "minutes"; // seconds, minutes, or hours
clock.addEventListener("tick", (evt) => {
// tick every minute
batteryHandle.text = `${battery.chargeLevel} `;
});
Best Answer