01-18-2020 17:54 - edited 01-23-2020 10:57
01-18-2020 17:54 - edited 01-23-2020 10:57
Hi,
The following function runs fine on the simulator, but when using the developer bridge and a real device I get "Something went wrong: TypeError: Failed to fetch". Hoping this would be resolved by release 3.13, but so far no luck unfortunately. Any ideas?
function storeSet(set) {
//ToDo remove unnessecary code after csrf token balooba
console.log("Storing set: " + JSON.stringify(set));
fetch(sets_url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(set)
})
.then(()=>console.log("Set stored!"))
.catch((err) => {
console.log("Something went wrong: " + err);
});
}
package.json:
{
"name": "******",
"version": "0.1.0",
"private": true,
"license": "UNLICENSED",
"devDependencies": {
"@fitbit/sdk": "~4.1.0",
"@fitbit/sdk-cli": "^1.7.1"
},
"fitbit": {
"appUUID": "***",
"appType": "app",
"appDisplayName": "***",
"iconFile": "resources/icon.png",
"wipeColor": "#ffffff",
"requestedPermissions": [
"access_internet",
"run_background"
],
"buildTargets": [
"higgs",
"meson",
"gemini",
"mira"
],
"i18n": {},
"defaultLanguage": "en-US"
},
"scripts": {
"build": "fitbit-build",
"debug": "fitbit"
}
}
01-18-2020 18:00
Gold Fitbit Product Experts share support knowledge on the forums and advocate for the betterment of Fitbit products and services. Learn more
01-18-2020 18:00
http or https?
Best Answer01-18-2020 18:19
01-18-2020 18:19
Same problem with both
Best Answer01-18-2020 18:36
Gold Fitbit Product Experts share support knowledge on the forums and advocate for the betterment of Fitbit products and services. Learn more
01-18-2020 18:36
access_internet permission?
Best Answer01-19-2020 01:15
01-19-2020 01:15
Yes I've added the permission but same problem.
Best Answer01-23-2020 11:01
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
01-23-2020 11:01
What's `sets_url`? Mask anything sensitive.
Best Answer01-23-2020 11:09
01-23-2020 11:37
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
01-23-2020 11:37
Is it possible there's an issue with your server implementation? You can verify the Fitbit app companion code is working by running kWS and testing a fetch().
https://play.google.com/store/apps/details?id=org.xeustechnologies.android.kws&hl=en
Best Answer01-23-2020 12:08
01-23-2020 12:08
Seems to be the same issue no matter what url I use. Even though I'm running my server in debug mode I cannot see any sight that a request is being received.
Best Answer01-23-2020 13:43
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
01-23-2020 13:43
Which version of Android are you using?
Best Answer01-23-2020 13:48
01-23-2020 13:48
Best Answer01-23-2020 13:51
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
01-23-2020 13:51
And you're definitely using the 3.13 Fitbit app?
How did you get on with kWS?
Best Answer01-23-2020 14:15
01-23-2020 14:15
Yes positive :
Same thing with kws, no sign of any request being received. Do you have any tips on how to debug this programmatically? Where is the error message "Failed to fetch" thrown from? Sounds pretty generic
Best Answer01-25-2020 02:59 - edited 01-25-2020 03:00
01-25-2020 02:59 - edited 01-25-2020 03:00
Chech your device webview version: it might need to support fetch https://caniuse.com/#feat=fetch
@JonFitbit does fitbit app polyfill the fetch function?
If not, there may be Android devices stuck with chrome 38 that has no fetch.
Best Answer01-28-2020 05:44
01-28-2020 05:44
Well, I installed the latest version of Android System Webview but same problem. I think I will try a different phone and see if things change
Best Answer04-21-2020 23:46
04-21-2020 23:46
Any update on this issue? Did you get it working? I am trying to send requests (fetch) to a local home automation server in the 10.x.x.x range. Not working with HTTPS (self-signed) or HTTP. Dev API documentation says it should work if by IP to local computers.
Best Answer04-22-2020 00:30
04-22-2020 00:30
@TechFan7 No unfortunately I've not gotten it to work. Tried two different phones after the last update, Huawei P3 and an iPhone 6S but still got the same error. So I've basically given up for now. What phone and app version are you using?
Best Answer04-22-2020 16:38
04-22-2020 16:38
I was just about to start developing for an internal system. . .and have run into this. I have Pixel 3a and with Android 10. It appears I have version 3.18.
Best Answer