05-28-2018 19:15 - edited 05-28-2018 19:18
05-28-2018 19:15 - edited 05-28-2018 19:18
I have code that uses file-transfer at the beginning of its launch to retrieve a JSON from my server. The JSON is retrieved instantly when I use the Fitbit Simulator, but takes ~5-30 seconds while running on an actual Fitbit Iconic. The JSON is ~500 characters long.
I'm pretty sure that the retrieval process is working and I believe that file should be on the watch - Looking at my console:
[8:54:20 PM]Transfer of 'habits.json' successfully queued.
[8:54:25 PM]/private/data/habits.json is now available
App's code:
// Event occurs when new file(s) are received
inbox.onnewfile = function () {
var fileName;
do {
// If there is a file, move it from staging into the application folder
fileName = inbox.nextFile();
if (fileName) {
console.log("/private/data/" + fileName + " is now available");
}
} while (fileName);
};
When I try to read the JSON while using my actual ionic watch I get the following error:
[8:54:30 PM]Unhandled SyntaxError: JSON string parse error.
When I use the Fitbit Simulator the code works flawlessly.
I'm receiving the error on the first line below:
let text = readFileSync("/private/data/habits.json", "json");
console.log(text);
habitsJSON = text;
VTList.length = habitsJSON.length;Am I missing something? Is this a bug in the ionic watch that doesn't exist within the Simulator?
My Firmware version is: 27.32.10.15 and it doesn't saw that I need to update.
One additional error I seem to be getting at the start of the app on both the Simulator and Watch: [8:53:54 PM]Error 22 Invalid value 'Start'
Thank you,
-Don
Best Answer05-31-2018 10:06
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.
05-31-2018 10:06
Do you have a project export that reproduces this issue, or a copy of the JSON content? Does it work if you use the CBOR encoding?
06-02-2018 05:49
06-02-2018 05:49
Thanks for the response and sorry for my delay.
I have not tried CBOR encoding, but the JSONs are really small in size, so I'm not sure what CBOR will buy me?
I placed the repository on gitHub: https://github.com/RocketMan1988/HabitTracker.
-Don
Best Answer06-20-2021 17:11
06-20-2021 17:11
Any news on this. Ran into the same issue: Parse is working on simulator, but not on Ionic.
Best Answer06-21-2021 06:31
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.
06-21-2021 06:31
Can you post the JSON?
Best Answer