Hey guys! I want to find a way to fetch active calories spent in the activities. No matter if it's the current one, or history of previous ones, I need at least one way to resolve my issue.
What I already tried with no success:
UserProfile.getUserActivityHistory()
- it allows to access activities but they don't havecalories
property.ActivityMonitor.getHistory()
- the entries here havecalories
property but it's a total of a whole day including "passive" calories. Additionally the data from this API is delayed by 2 days (at least for my device).Background.registerForActivityCompletedEvent()
- this one would be perfect but when activityCompletedEvent happens the background app is provided with a useless{ sport, subSport }
dictionary with no data about the completed activity. CallingActivity.getActivityInfo()
right after the event is not stable due to unclear timing of the events (it can returnnull
if the event happened when the activity was already finished).- I thought about using
Background.registerForTemporalEvent()
for polling theActivity.getActivityInfo()
(it has calories property of the current activity) every 5 seconds but there's a 5 minutes limitation in the system. It means there is a huge chance to miss calories spent within last 5 minutes of the activity.
The question: do you know anything that could help me to get active calories for an activity?
Right now I'm about to give up. I've been working on an app for over a month (almost finished) and this functionality was crucial. Quick investigation of the docs before I started tricked me that there's plenty of ways to get active calories of an activity, but looks like it's impossible.
Thanks for your attention