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"
}
}
Same problem with both
Best AnswerYes I've added the permission but same problem.
Best Answer
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.
What's `sets_url`? Mask anything sensitive.
Best Answer
Best Answer
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.
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 AnswerSeems 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 Answer
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.
Which version of Android are you using?
Best Answer
Best Answer
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.
And you're definitely using the 3.13 Fitbit app?
How did you get on with kWS?
Best AnswerYes 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 AnswerChech 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 AnswerWell, 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 AnswerAny 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 Answer@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 AnswerI 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