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

fetch() for local IP access

According to the documentation "Please note: fetch() can only be used to access https endpoints and resources, except when accessing resources on a local network by IP address."

 

The simulated device works and successfully sends a GET to my machine on the same subnet (192.168.1.x). However, when I deploy this to the watch, it complains that fetch() only supports https.

 

Is this a known issue? Is there a workaround?

Best Answer
0 Votes
6 REPLIES 6

A recent Android security change has affected fetch() usage. We have whitelisted a few IP addresses, which only really helps for a few specific use cases. We have an update coming for the Android app which adds 2 ranges. 192.168.0.0/24 and 192.168.0.1/24. I can't say when it will be released, but it's coming soon.

Best Answer
0 Votes

This post states that the only unsecure IPs usable are 127.0.0.1, 192.168.0.1, 192.168.1.1, and 10.0.0.1. Does that restriction only apply to the Android version of the Fitbit app, or are the ranges mentioned above (192.168.0.0/24 and 192.168.0.1/24) currently accessible through the iOS version of the Fitbit app?

Peter McLennan
Gondwana Software
Best Answer
0 Votes

iOS doesn't currently have the same restrictions, and Android will be allowing more IP addresses soon.

Best Answer

Any update on this? My home network uses 10.1.10.x so—as I discovered to my dismay today—Fitbit apps can't access things like my Philips Hue Bridge, which uses a self-signed cert for HTTPS, or unsecured HTTP. I'm pretty sure that the 10.1.10.x range being omitted from the allowed IP range is an oversight, because that is one of the more common internal network ranges.

Best Answer
0 Votes

Hi, so I'm developing an app that transmits sensor data from my Versa 3 through my companion (Mi9T Pro) running Android 11. My app runs on NodeJS from an http://192.168.4.x machine. When using the simulator it works fine, but running it from my actual watch and smartphone, I'm getting the dreaded "TypeError: Failed to fetch" error. I've tried using a self-signed certificate, but the problem persists.

You stated in an earlier post that this is due to Android restrictions. So, would my setup work if I use iOS? I really need to get this working, as I'm developing this app for my thesis!

Best Answer
0 Votes

I don't know about iOS. However, it's possible to run some nodeJS code on Android using this, in which case you can probably use one of the allowed http IP addresses. It's a bit weird, though; if iOS permits LAN IP addresses, that would be neater.

Peter McLennan
Gondwana Software
Best Answer
0 Votes