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

Companion fetch API doesn't get data when running on device not simulator

ANSWERED

When I try to reach a .jpg file from a public IP address while running the app from the simulator it works perfectly but when I try to load the file from an actual device (Fitbit versa) it doesn't get any data.

 

If I switch to a local IP address it works as expected.

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Yes the network is OK also the permissions are correct. 

Like I mentioned it works in the local network http://192.168.x.x/api but when I switch to my public ip address it doesn't work (using http).

My workaround was to create an Azure function (it uses https) that calls my http service.

 

So my conclusion is you cannot make http requests with the actual device, that's a boomer given that the simulator works OK.

View best answer in original post

Best Answer
0 Votes
3 REPLIES 3

Have you given your app Internet privileges in the package.json?

 

Otherwise we'll need to see code to know more. There's some example code here : https://dev.fitbit.com/build/guides/communications/file-transfer/

 

I struggled with getting the example file transfer to work originally but it turns out here's a bug with filename character case: https://community.fitbit.com/t5/SDK-Development/File-Transfer-Extension-Capitalisation/m-p/2366479

 

Sometimes network connectivity on my phone breaks and I can get it back by restarting my phone, so I'd check that too.

Best Answer
0 Votes

Yes the network is OK also the permissions are correct. 

Like I mentioned it works in the local network http://192.168.x.x/api but when I switch to my public ip address it doesn't work (using http).

My workaround was to create an Azure function (it uses https) that calls my http service.

 

So my conclusion is you cannot make http requests with the actual device, that's a boomer given that the simulator works OK.

Best Answer
0 Votes

Ah yes, makes sense now.

 

Some fitbit companions do not support HTTP (I believe Android and Windows Mobile still), only HTTPS. However the simulator does not enforce this constraint/bug (and said constraint/bug is not yet documented).

 

See: https://community.fitbit.com/t5/SDK-Development/Is-Fetch-limited-to-https/m-p/2220283#M270

Best Answer
0 Votes