07-13-2019 14:15
07-13-2019 14:15
Hi,
I have implemented an app for Fitbit Ionic using Fitbit Studio. The app is a simple game but I don't know how I can store data when a user is finished with the game. I'm new to the Fitbit app development. Could some one tell me how I can store the game data? Thanks a lot.
Answered! Go to the Best Answer.
08-27-2019 13:47
08-27-2019 13:47
Such files are stored on the watch. If you want them elsewhere, you have to use File Transfer to get them to the companion; then you can use fetch or WebSockets to send them to a server.
07-13-2019 14:21
07-13-2019 14:21
Have a look at onunload and the File System API.
08-27-2019 04:36
08-27-2019 04:36
Thanks. Can I get access to the files after my app is published? And if yes, is it possible to read the files via the web API?
08-27-2019 13:47
08-27-2019 13:47
Such files are stored on the watch. If you want them elsewhere, you have to use File Transfer to get them to the companion; then you can use fetch or WebSockets to send them to a server.
09-04-2019 03:06 - edited 09-04-2019 04:16
09-04-2019 03:06 - edited 09-04-2019 04:16
Thank you. I also have another question. What happens if I use file transfer to send a json file from the app to the companion but not send it to a server? Can I still get access to the json file after the app is published by Fitbit?
09-04-2019 13:37
09-04-2019 13:37
Publishing the app won't make any difference to your ability to access data. That's the good news.
The bad news is that the file on the companion isn't accessible outside of the companion. You can't get at it using a file manager. Even inside the companion, it's really more like a variable in memory than a file in storage.
09-04-2019 13:45
09-04-2019 13:45
09-04-2019 13:50
09-04-2019 13:50
Yes, I'm afraid so. If you really want an on-companion-device solution, you could send it to a 'server' running on your companion device; ie, a local program that can intercept the fetch() or WebSocket output from your companion code.
09-04-2019 13:54
09-04-2019 13:54
09-04-2019 13:58
09-04-2019 13:58
Sorry. 😞