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

Clockface + API Fetch

Hi Guys!

 

I'm starting to develop for FitBit now, so it might be a silly question... if so, sorry in advance 🙂

 

I started a Clockface project in Studio, and I would like it to display information that I would capture via API... updating this data would be once or twice a day.

 

In this case, from the default Clockface project I created a companion folder, added an index.js and added the internet_access permission. The file content is:

 

 

 

console.log("Running companion");

fetch("https://www.terra.com.br")
  .then((response) => {
    console.log(`Response: ${response.statusText}`);
  });

 

 

 

I have no errors when running, but in the console it appears:

 

 

[20:51:31]App Started[HOST]
[20:16:30]Loaded and evaluated: file:///android_asset/bootstrap.jscompanion/index.js:1,1
[20:16:30]Running companion[HOST][20:16:30]Loaded and evaluated: file:///data/user/0/com.fitbit.FitbitMobile/app_companions/a932b5b1-5633-4071-8466-b16d00d82da3/0x0a4de3523b8247ce/companion.js[HOST]
[20:16:30]Companion aberto por [launchedOnTracker]companion/index.js:3,1
[20:16:30]Response: No message received.[HOST]
[20:16:31]Companion descarregado

 

 

It doesn't return any messages... if I try to use a url without SSL (http), it returns an error saying that to access an internet url, I have to use https.

 

Does anyone have any idea what it could be?

 

Thanks!

 

Best Answer
0 Votes
0 REPLIES 0