05-18-2020 06:03
05-18-2020 06:03
hi their,
sorry for asking , i m very new to fitbit SDK and i have a very few skills in programing.
i have almost finished my first app, now i only need to parse a few ints from the settings on the phone to my app...
i'm messing around for hours now... and all examples i can found are color relative and i'm missing the very basic int transmission.
so here is what i have :
in settings index.jsx
i need the user to give me an int:
<TextInput
label="Heure"
placeholder="HH"
settingsKey="Heure"
/>
then in companion i keep the default script witch i assume is prefect.
then in app/index.js:
import document from "document";
import * as messaging from "messaging";
var monHeure = 0;
// Message is received
messaging.peerSocket.onmessage = evt => {
// i want my var to be filled with the TextInput value as so:
// monHeure= the value of "heure"??
}
It looks so simple that i really apologise for the question...but beginning in programing every thing is such a pain.... If you could show me the right methode &syntax i would really be thankfull!
Merci!!!
Answered! Go to the Best Answer.
05-18-2020 08:18
05-18-2020 08:18
// Message is received
messaging.peerSocket.onmessage = evt => {
console.log(`App received: ${JSON.stringify(evt)}`);
if (evt.data.key === "Heure" && evt.data.newValue)//////////////////////////////////
{
monHeure = (JSON.parse(evt.data.newValue)).name;
console.log(`New date: ${monHeure}`);
}
05-18-2020 08:18
05-18-2020 08:18
// Message is received
messaging.peerSocket.onmessage = evt => {
console.log(`App received: ${JSON.stringify(evt)}`);
if (evt.data.key === "Heure" && evt.data.newValue)//////////////////////////////////
{
monHeure = (JSON.parse(evt.data.newValue)).name;
console.log(`New date: ${monHeure}`);
}