05-26-2020 20:11
05-26-2020 20:11
Howdy Fitbit Gurus,
We are making a health mobile app (IOS,Android) and would like to connect the app to Fitbit devices to access various sensor data for our app. Please advise how this can be done.
Cheers
05-27-2020 14:19
05-27-2020 14:19
Hello,
There are two ways to do it.
1) I have only done this with an Android app so am unsure if Apple allows it, but you can run a localhost webserver and use it as a go-between between your app and the fitbit host app. Then, you could use fetch and post to communicate with your application.
2) You can use either an external or internal server and use the messaging or file transfer (it sounds like you want the messaging API). External servers need better security and different permissions.
05-30-2020 17:26
05-30-2020 17:26
Thanks LekoFraggle.
"go-between between your app and the fitbit host app", does this mean that the Fitbit app needs to be running in order for this to work?
05-30-2020 18:19
05-30-2020 18:19
Yes, the Fitbit app needs to be running (as well as the server app), although running in the background is normally okay(ish). This can be a problem. Make sure that battery-saving settings aren't too ruthess with the app (expecially on iOS).
05-31-2020 08:02 - edited 05-31-2020 08:03
05-31-2020 08:02 - edited 05-31-2020 08:03
I do not understand this 100 percent, and this may be different on iOS, but remember running in the background on a phone (Android anyway), does not work the way we think of it. Because Android uses a JIT scheduler, just because an app is running does not mean it is actively using memory. It uses event handlers to do that. If I am not mistaken, the fibit app is constantly running already if you (and/or your users) have selected for the app and watch to be "always connected."
Always running does not necessarily mean persistently using a lot of memory.
Where things go awry quickly is if you use the wrong event handlers and do not cancel lifecycle events (fitbit) or actively tell the app to avoid garbage collection (Server App in Android).
I feel creating a forever loop that is constantly polling will be a problem, but also it seems that both the fitbit and Android dev teams have done a lot of work on this, and any attempt to manage resources will go a long way.
Again I am just beginning to do research on this, so I may be completely off-base.
05-31-2020 22:33
05-31-2020 22:33
It seems that the issue is an unknown.
Wish that official Fitbit representative would answer this question directly. This forum is from Fitbit so please guys, we need transparency and info.
Cheers.
06-01-2020 10:23
06-01-2020 10:23
I feel they are open about this. The link I provided earlier seems to be their official statement. I also do not know they will reply directly in the forum, but it is a possibility.
I do not work for fitbit and just began tinkering with the SDK, but I feel there are major benefits from this. If you do not want the server on the device, then you could have your app communicate directly with an online server, but that has its own host of drawbacks too. Either way you look at it, there are drawbacks. What I feel we have here is a good compromise. I get that it is not perfect, however, I bought a fitbit because after 3 different Android Wear watches I realized that in order to have that open platform, the battery life suffers significantly (the health tracking too FWIW). So, I feel the extra server hassle is worth the price of admission to have a device that does not require charging twice a day.
06-02-2020 05:59
06-02-2020 05:59
@EmeraldFalcon wrote:
It seems that the issue is an unknown.
Wish that official Fitbit representative would answer this question directly. This forum is from Fitbit so please guys, we need transparency and info.
Cheers.
The community answers are correct. There's no direct connection to the devices. If you want to relay data to your app, the only methods are fetch() or WebSockets in the companion API. the choice then is whether you use a web server on the internet, or a local webserver in your app.