1

I am trying to retrieve my sleep data in REAL TIME. I cannot find how to achieve it from docs: UP Platform Android SDK

P.S. : I am willing to conduct sleep experiment that requires getting an event when I reach e.g. paradoxal sleep phase. Thanks!

Josh Anin
  • 11
  • 1

1 Answers1

1

Using the UP APIs, the closest you can get to real time updates is to have your application register for PubSub event notifications for sleep events:

Sleep event description from the PubSub docs

There are two limitations that will keep these event notifications from occurring exactly in real-time:

  1. PubSub events are only triggered when the band syncs data to the phone.
  2. PubSub sleep events are only triggered for a complete sleep and not for individual phases.

Regarding #1, the band (UP24 and newer) must have an active bluetooth connection with the phone and then syncs will usually occur within 15 minutes.

For #2, calculation of the different sleep phases currently requires reviewing the band data for the entire sleep event, so the API cannot send individual event notifications for phase changes.

RAY
  • 474
  • 4
  • 21
  • What do you mean by events are only triggered when the band syncs data to the phone, does this require opening the UP app? Because I do have an active bluetooth connection but failed to get the sleep data unless I open the UP app. – Samuel Méndez Oct 18 '16 at 11:53
  • The UP app does not have to be open or in the foreground to sync data. It can be in the background. However, in some instances (like low battery), the phone's OS will prevent bluetooth syncing with backgrounded apps, particularly if your bluetooth connection has dropped while backgrounded (e.g., you walked away from your phone). In these instances, you may have to bring the UP app to the foreground to re-establish syncing. @SamuelMéndez, for the behavior you're describing, do you only get sleep data after you open the UP app? Is it possible that your phone dropped connection in the night? – RAY Oct 18 '16 at 14:39
  • It's possible because I turned off the tablet during the night so it might lose the connection but it should be reconnected when I turn the tablet on in the morning (both tablet and jawbone's battery are full). I can perfectly get the steps and calories (UP running in background, without open in foreground) using the pubsub, but it never send the sleep notification. – Samuel Méndez Oct 18 '16 at 15:11