android / android/health-samples

ActiveCaloriesBurnedRecord returns empty list despite available data in google fit app

Open
#328 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
346
Forks
183
PR merge metrics
No merged PRs in 30d

Description

I am currently integrating Health Connect into my Android app and trying to read ActiveCaloriesBurnedRecord using the Health Connect client. However, the result is consistently an empty list, even though I have confirmed that there is active calorie data present in the Google Fit.

I have verified:

- The app has the necessary read permissions for ActiveCaloriesBurnedRecord.
- Other types of records like StepsRecord or HeartRateRecord return valid data.
- I have queried with a valid time range that should contain active calories data.

**Code Snippet:**
```
val request = ReadRecordsRequest(
recordType = ActiveCaloriesBurnedRecord::class,
timeRangeFilter = TimeRangeFilter.between(startTime, endTime)
)
val response = healthConnectClient.readRecords(request)
val records = response.records
```

**Permissions Granted:**
```
setOf(
Permission.read(ActiveCaloriesBurnedRecord::class),
// Other permissions like StepsRecord and HeartRateRecord
)
```

**Device & Setup Info:**

- Device: Samsung Note 20, Android 13
- Health Connect Version: 1.1.0-alpha07
- Health Data Source: Google Fit, Health Connect Client
- Kotlin/XML
- Health Connect Installed via Play Store

**What I Expected:**
The client should return a list of ActiveCaloriesBurnedRecord within the queried time range if the data exists in Health Connect.

**What Actually Happened:**
The result is always an empty list even when active calorie data is visible in the source app.

Let me know if you need a sample project or logs. I’m happy to provide more information.

Contributor guide

Open the contributing guide

Research direction

Start with the ReadRecordsRequest snippet, ActiveCaloriesBurnedRecord permission, and readRecords entry point described in the issue. Compare the queried time range and Health Connect data source with the working StepsRecord and HeartRateRecord cases. Done means the empty result is reproducible and its cause and expected record behavior are documented or fixed.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.