02-14-2022 07:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-14-2022 07:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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.
Accepted Solutions
02-14-2022 11:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-14-2022 11:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
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.
Gondwana Software
02-14-2022 11:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


02-14-2022 11:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
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.
Gondwana Software
02-15-2022 06:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

02-15-2022 06:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Okay, thank you very much.
I will try this today
Regards,
Oin
