Fitbit Ionic/Versa beta integration


#21

When I start Sleep-app in phone, it doesn’t start in watch, as it did on Pebble. When I start Sleep-app in watch, it starts in phone. (With server running).

I can confirm that the app in watch turns itself off after aprox. 40 minutes. Last night I restarted app in watch whenever I woke up, stopped after about 40 mins.

Huawei Mate 10 Pro, Android 9
Fitbit Versa 32.33.1.30
Sleep as Android 20190313 BETA


#22

Great point about the heart rate. It’s not on my second night graph. However, I looked back and noticed it was on my first night graph (now). I assume it’s my FitToFit app pushing it to Google and then Sleep syncing back down because it has graph points during time that my watch app was not running. That makes me assume maybe I’ll see second night heart rate tomorrow.


#23

Hello everyone, hope you all had a nice weekend!

Thank you very much for the very valuable tests. I’ll cater to the individual issues below one by one.

App crashing on the watch after ~40 minutes
I’m now trying to pinpoint the issue, which I hope to be something on my part. I don’t think that’s something in the Fitbit OS itself is killing the app as there is supposed to be no battery management/optimalization AFAIK on the watch that would be capable of killing the app apart from when it runs out of memory dedicated to its container. So actually running out of memory is the most likely culprit.

Server running throughout the day
The server on the phone does not need to run all day, it only needs to be running prior to starting sleep tracking and can be turned off after sleep tracking ends.
However, when sleep tracking is not currently running, the server does not do any processing, and thus does not drain any battery. It doesn’t keep your phone CPU alive (ie. does not keep a wakelock) and consumes absolutely no resources apart from statically occupying a few kilobytes of memory.

Starting sleep tracking from the phone
It is only possible to start sleep tracking from the watch. Due to constraints of the Fitbit SDK, it is not possible to start a watch app from the phone.
I have noticed a flaw in the flow if you try to do it the other way - if you start sleep tracking from the phone, we still start it and signify that Fitbit is connected, so that needs to be fixed.
This also most probably has something to do with the #sonar tags appearing along the #watch tag on the graph for @djjstew as you’ve correctly observed.

Heart rates not working
That’s a bug somewhere on my part, they should be working, I’m looking into it.
@treyhendon yep I assume you got them through FitToFit…


#24

Great to know about the wakelock @jiri-urbandroid thanks! Overall, I will close the server during the day because it is in my notification tray and I like to keep that empty. :slight_smile:

Regarding starting from the phone, an overall suggestion about that flow from a user perspective:
When the app has FitBit selected as the wearable, the documented process is to start the phone app tracking then launch the app on the watch. On the phone screen, when sleep tracking is started, it would add the message for the FitBit user to start the app on their watch and in the background this would auto-start the server. Then, when tracking is finished the server would stop.

Just my thoughts on what could be a good experience. Look forward to hearing what you’ve found out.

As a note, I’m not sure because the tracking was not fully functioning, but it’s possible that my watch battery was hit hard. However, if it is a ram issue as you suspect, I could also see how that might impact battery. Once we get a new build of the betas, I’ll better monitor my battery usage.

Thanks for letting us help!


#25

@treyhendon I also got the feeling that there was higher battery usage while using the app but agree with you that we need all night functionality and a lot more data to be certain.


#26

Do you all have Fitbit Versa or does anyone have a Ionic?
I did a 9-hour test right now on the Ionic and the app didn’t stop once.

Not sure about the battery, since I had it about half of the time on charger, but now when I stopped it, I see 95%, and it was at least 3 hours away from the charger.

I will have a version with better logging tomorrow. It is weird since actually what you report (intermittent stopping, large battery hit) is something that I experienced a few versions of my code back, but not with the version I released to you (and which I’m testing now).


#27

I have had the same issue with my versa. Starts server and connects fine and tags with #watch but only tracks a very short period (looked like around 30 minutes on the graph) with the watch app not being running when I check it in morning.


#28

Hi Jiri: Versa here with Note 9 on Android 9


#29

I have an ionic and I emailed you. Mine dies in the middle of the night but for some reason I only have a version as new as the 13th version 0.3


#30

TL;DR: New version (0.4) of the Fitbit app is at the same link (https://gam.fitbit.com/gallery/app/90650cd6-76fa-40db-a747-240ac7da8a02)

Sorry for not being as responsive as I thought I’d be!

So, to keep you all updated on what’s happening with the Fitbit integration, let me share our progress.

With the reports that the app does never last a night, I had several things to check.
The most probable suspect was an out of memory error. With the app we’re running close to a memory limit on the device (there is the same amount of operational memory available on Ionic and Versas). So we thought maybe in some cases we could run over the threshold and be killed by the system.
Profiling didn’t show any memory leak but it could be that I’m just doing something different unconsciously when testing.

So what thought next (as @skywurz did) is that it might be so easy to switch off the app during the night by the left watch button that it would happen to everyone.
This chance should be now mitigated by an exit confirmation dialog.

If you are willing to test the new version, please do and then send me a debug log from Sleep in the morning (left menu > report a bug).


#31

Debug sent. I just tested while awake and after 35-40 min the watch app stopped out of nowhere. :frowning:. I did notice something odd when starting the app on the watch it crashed instantly a couple of times before it ran it almost seemed like a connection issue with the phone service? I’ll test some more. If there is anyway I can get you useful info from the watch or anything let me know.


#32

Sent a second report same thing again. This time I was hopeful because I got the tracking to start on my phone from the watch . Does the watch app have any sort of die on loss of connectivity with the phone service?


#33

Thanks a lot @skywurz!
We’ve taken a quick look at the logs and even though I can’t reproduce it on my test watch it really seems there is a memory issue/leak which we’ll be looking into tmrw.

Connection should be solid in the sense that nothing should happen if you disconnect/reconnect the watch, messages are kept in a persistent memory so they do not pollute our operational memory space.

Getting logs from the watch is impossible as far as I know, what we do is send messages from the watch and log them on the phone but of course we can’t get logs that directly precede crashes or the crashes themselves this way.


#34

Hey guys, got a new version to test. Version 0.5 at your disposal here (again the link remains the same).

I’ve managed to reproduce the issue you’ve all encountered right away :slight_smile: and it led me to find some bugs.
So, what’s fixed:

  • heart rate monitoring should work now. This was most probably the culprit as a loose bracket made the app accumulate your heart rates indefinitely in memory and never send them. And then crash.
  • there was another issue with starting the HR sensor where the device expected a message in a slightly different format than it actually receives
  • another issue was that the watch and Sleep were pinging “start tracking” messages back and forth for the whole time sleep tracking was running, probably causing issues with sensors being initialized multiple times and that was probably causing irregular spikes in memory usage

As always, if you encounter any issues, please send me a debug log from Sleep (menu > report a bug).

Thank you very much and fingers crossed!


#35

Good morning! Had problems last night getting my Versa and phone apps to sync up. The phone app would instantly start tracking and say it was linked to watch, but my watch would say it was trying to connect. I powered off both and started over. I then was able to start tracking on phone and watch and they both said connected. This morning my watch app is not running and when I look at my charts I have 2 sleep records for last night.

Pixel [1], Android 9, Sleep 20190329
Versa, 33.32.1.30, Sleep 0.5


#36

just saw this on Sat morning (one of those weeks) and downloaded and decided to play with it for a bit. Had starting issues and syncing issues as well. So I did the following:

  • uninstalled the Versa App
  • restarted the Versa and my Note 9 (I like to do that once a week anyway)
  • downloaded/installed the updated Versa App
  • things seemed fine, the true test will be tonight when I sleep

I will check back in tomorrow morning thanks Jiri!


#37

Just sent in a crash report via phone app. The watch app had stopped itself when I got up.

Last night I was able to have a single chart. When tracking started (I have a 5 min delay) I saw indication that heartbeat was working. This morning, looking at the graph, only 5 min is recorded and no heartbeat indicated. I assume that means the app stayed alive on the watch 10 min.

Hope that helps!


#38

I had to do the same thing because I was having similar issues


#39

Everything seemed fine last night the app on the Versa was running when i woke up. But I did not get anything on my graph. Will try again tonight.


#40

@djjstew Can I also ask you for the debug log? (Menu > report a bug from Sleep) Big thanks!