12-10-2022 13:30
12-10-2022 13:30
I am trying to make a new app with 2 settings, and I've created a settings/index.jsx with the appropriate items in it, but I don't see how to access that in the app itself now that I have it running on my fitbit sense?
What am I missing?
12-10-2022 22:51
12-10-2022 22:51
You need to 'catch' the setting changes in your companion app, and send them from there to the watch app using File Transfer or Messaging.
12-11-2022 07:30 - edited 12-11-2022 08:57
12-11-2022 07:30 - edited 12-11-2022 08:57
I think I have that, I've got:
messaging.peerSocket.addEventListener("message", (evt) => {
if (evt && evt.data && evt.data.key === "exerciseMode") {
exerciseMode = evt.data.value;
}
if (evt && evt.data && evt.data.key === "sleepMode")
{
sleepMode = evt.data.value;
if (sleepMode == true)
{
nightInterventionCount = 0;
}
}
});
But I don't see how to call the settings, so that they can be changed in the first place?
settings/index.jsx
function mySettings(props)
{
return
(
<Page>
<Section
title={<Text bold align="center">Turn on Exercise Mode?</Text>}>
<Toggle
settingsKey="exerciseMode"
label="Exercise Mode"
/>
</Section>
<Section
title={<Text bold align="center">Turn on Sleep Mode?</Text>}>
<Toggle
settingsKey="sleepMode"
label="Sleep Mode"
/>
</Section>
</Page>
);
}
registerSettingsPage(mySettings);
12-11-2022 08:27 - edited 12-11-2022 08:28
12-11-2022 08:27 - edited 12-11-2022 08:28
Hi, have a look at this example for color-setting. Maybe it helps to show the relations: