02-14-2022 07:15
02-14-2022 07:15
Hello dear forum,
I'm in the process of writing an app for my Versa 2, which should, for example, receive and display the weather data from the Fitbit Weather API.
Because the getWeatherData function has to be in the companion folder and cannot be written to the index.gui from this file (as far as I can tell), I wanted to create an "export function" to then continue in /app/index.js to be able to use.
But I get both a reference error for "export" and an error in the build output. Mostly "cannot set "code" on boolean "true".
Do you have a solution for the problem?
I'm new to the Fitbit Studio, maybe the approach is wrong...
Regards,
Oin
PS: I've already looked at the example with "BART" from Fitbit, but didn't find any differences to my program
Answered! Go to the Best Answer.
02-14-2022 11:53
02-14-2022 11:53
I haven't used the weather API in anger, so...
The companion folder indicates code that will run on the phone, rather than the watch. (I think you're right that the weather data has to be accessed on the phone.)
import/export won't work in this case, because app code runs on the watch, whereas companion code runs on the phone.
I think you'll need to use messaging or file system to send data from companion (phone) to watch.
02-14-2022 11:53
02-14-2022 11:53
I haven't used the weather API in anger, so...
The companion folder indicates code that will run on the phone, rather than the watch. (I think you're right that the weather data has to be accessed on the phone.)
import/export won't work in this case, because app code runs on the watch, whereas companion code runs on the phone.
I think you'll need to use messaging or file system to send data from companion (phone) to watch.
02-15-2022 06:10
02-15-2022 06:10
Okay, thank you very much.
I will try this today
Regards,
Oin