02-06-2019 01:12
02-06-2019 01:12
I open this thread because of a problem related to the new File Transfer API to transfer a file from the device to the companion app. The problem is that after a file is enqueued, it takes so long before the file is received from the companion app running on the smartphone.
For example, a file with a size of 6 MB takes 7 minutes before the companion app receives it and a file of 15 MB takes 30 minutes.
This is a piece of code that I'm using to transfer a file from the device to the companion app:
outbox .enqueueFile(accRecordingFileName) .then((ft) => { counterFile++; console.log("Transfer of " + ft.name + " successfully queued."); }) .catch((error) => { console.log("Failed to schedule transfer: " + error); });
// Process the inbox queue for files, and read their contents as text async function processAllFiles() { let file; while ((file = await inbox.pop())) { console.log("Il nome del file è: " + file.name); sendFile(file); } } // Process new files as they are received inbox.addEventListener("newfile", processAllFiles); // Also process any files that arrived when the companion wasn’t running processAllFiles();
I have also put a piece of code to wake the companion app every 5 minutes, but nothing changed.
me.wakeInterval = WAKE_INTERVAL; me.onwakeinterval = evt => { console.log("Companion was already awake - onwakeinterval"); processAllFiles(); } if (me.launchReasons.wokenUp) { console.log("Started due to wake interval!"); processAllFiles(); }
Why the transfer speed is so slow? Any suggestions?
Thanks in advance,
Davide
02-06-2019 15:34
02-06-2019 15:34
Maybe someone from Fitbit can confirm, but I think that the File-Transfer API still uses BLE for communication... so this not WIFI.
AFAIK the WIFI is not available for mere mortals. Only some privileged apps can use Wifi,
BLE is slow.
--------
I see the Fitbit OS API in this way:
* Messaging API - is in fact UDP style signaling API for tiny messages. You can only send messages up to 1k, only when app and companion are running in the same time, only when BLE connection is established
* File-Transfer API - TCP style communication for small messages - You can exchange data while app or companion are stopped.
The whole FitbIt app can use up to 10MB on the device, so I don't think that Fitbit OS is ready for large file transfers.
02-08-2019 01:31 - edited 02-08-2019 01:34
02-08-2019 01:31 - edited 02-08-2019 01:34
Thank you for your answer, adiroiban!
When I did a similar thing with Wear OS, the speed was faster and files were being transferred via Bluetooth, so am I to understand that Wear OS API uses the normal Bluetooth and not the BLE.
It would be interesting to know from Fitbit if it is possible to use the Wi-Fi connection to transfer the files or if there is another way faster than the current one.
02-13-2019 01:04
02-13-2019 01:04
During my last tests, I noticed another interesting aspect. When the companion app is installed on a Google Pixel 2 XL, the transfer speed of the files from the Fitbit Versa to the smartphone is significantly faster than when the companion app is installed on other devices such as Galaxy S5, Galaxy S7 and Nexus 6P.
Apart from the Android version (5.0 on Galaxy S5, 8.0 on Galaxy S7, 8.1 on Nexus 6P and 9 on Pixel 2 XL) the difference between these devices is the bluetooth version. Indeed, Google Pixel 2 XL has Bluetooth 5.0 and the other devices have the 4.0 version (Galaxy S5) and 4.2 version (Galaxy S7 and Nexus 6P).
According to you, can this last aspect influence the transfer speed of the files from the Fitbit Versa to the smartphone? Has anyone run into the same problem?
Thanks in advance,
Davide