https://appdb.winehq.org/objectManager.php?sClass=version&iId=36675
https://github.com/bingtimren/fitbit-sim-starter
Wifi will not connect if device has less than 25% battery
/app/
/common/
/companion/
/resources/ (gui, css, images, etc.)
/settings/ (jsx, tsx)
application <= 10m
file space <= 15m
Use Clock API and tick events instead of setInterval() to reduce battery impact
Each app has own private area
/private/data is only place writable & default dir
/mnt/assets/resources - application's resources/ are mounted readonly (PNG converted to TXI)
All methods are synchronous
Recommended approach:
Some APIs needs to request permission first before usage
Interface: JSX with restricted tags
Persistence
Settings API (used by JSX)
value={props.settings.color}
onChange={value => props.settingsStorage.setItem('color', value)}
Currently seems there's no "official" way but https://github.com/SergioMorchon/fitbit-sdk-types
Coordination:
Elements:
API Reference: https://dev.fitbit.com/build/reference/device-api/document/
import document from "document";
document.replaceSync("./resources/another-view.gui");
This has performance benefits as well as better code organisation.
See https://dev.fitbit.com/blog/2019-10-29-announcing-fitbit-os-sdk-4.0/
https://dev.fitbit.com/build/guides/user-interface/javascript/#using-the-physical-buttons
Prevent default action of physical buttons
https://community.fitbit.com/t5/SDK-Development/Physical-Button-Exit-App/td-p/2375320
import document from "document";
import { me } from "appbit";
document.onkeypress = function(e) {
console.log("Key pressed: " + e.key);
e.preventDefault();
if (e.key==="up") {
console.log("trapped");
me.exit();
}
See https://dev.fitbit.com/build/guides/user-interface/javascript/#events
Note: when one component (rect etc.) is covered by another, click event is not passed to the under laying component, if the covering component is merely hidden (.style.visibility = "hidden"; // hidden). To expose the under laying component, set the covering component's display attribute (.style.display = "none";)
https://dev.fitbit.com/build/reference/device-api/
All apps by same developer can share app cluster storage by same ID.