Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with the Weather API in Versa 2 - Error!

ANSWERED

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

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

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.

Peter McLennan
Gondwana Software

View best answer in original post

Best Answer
2 REPLIES 2

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.

Peter McLennan
Gondwana Software
Best Answer

Okay, thank you very much.

 

I will try this today

 

Regards, 

Oin

Best Answer