05-12-2021 07:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-12-2021 07:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
My app is collecting some sensor data on Versa 3 and sending it via File Transfer API to the companion. After an unpredictable amount of time (highly variable each time), the sensor data freezes (becomes constant) and the data is no longer sent to the companion. I am also cleaning my cue outbox and deleting files in FitBit memory so those could not be the problem
Is there some sort of OS intervention? What could be the reason?
I appreciate help

06-01-2021 04:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


06-01-2021 04:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Is it an app or a clock?
How long typically does it last before freezing?
Have you checked the memory usage for a leak? https://dev.fitbit.com/build/reference/device-api/system/#variable-memory
Does relaunching the app fix it, or do you have to reboot?
Which device & firmware version?
Does it do the same in the simulator?
06-04-2021 08:48
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-04-2021 08:48
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks Jon for your response.
So, it is an app. The device app takes batch readings from heart rate and acceleration ... formats them into json arrays ... then puts the json arrays into a file and uses the file transfer API to send the file to companion ... the companion sends each json string to a google cloud server.
We checked the memory ... we are not running over ... We seem to freeze every couple of hours or so but I added a button that restarts the sensors and that seems to unfreeze the app until it freezes again.
Relaunching the app or rebooting the Fitbit unfreezes it yeah. The device is versa 3 with SDK version 5.0. Yeah same in the simulator with no errors shown ... the print statements in the console just stop with no errors.

06-07-2021 09:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


06-07-2021 09:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I wonder if the Fitbit mobile app is getting suspended for battery optimisation. Can you check the settings on your phone?
There's a couple of things you might try:
1. Companion wakeInterval every 10 mins
2. Send a ping from the device to companion, then reply from the companion to the device. Use the Messaging API for this.

06-07-2021 09:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-07-2021 09:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks for your response. Will implement this and let you know. As I read batch readings, I also update them on the Fitbit device UI and when the app crashes, every time the sensor readings also stay constant and stop changing on the Fitbit screen. This is independent of the companion. Based on this, I believe the error is coming from the Batch readings. In addition, when I restart the sensors using the sensor API (for example hrm.stop()), the app starts working again for a short time and crashes again. Is the sensor batch reading likely to freeze and is there anyway to make it more robust for longer periods of time without crashing?

06-07-2021 09:23
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


06-07-2021 09:23
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I see, that does sound more like the sensors then. Which sensors are you running concurrently and which options are you using for them?

06-07-2021 09:38 - edited 06-07-2021 09:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-07-2021 09:38 - edited 06-07-2021 09:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I am running body presence (without batch) and heart rate and accelerometer with batch (frequency: 1, batch: 30). Basically, for each batch reading I create a json file and queue it using File Transfer API to companion. This is my code for heart rate for instance:

