Skip to content

Conversation

@agilst
Copy link
Contributor

@agilst agilst commented Jan 13, 2026

Issue

In the current implementation of HealthDataReader.handleWorkoutData() is forcing us to have TotalCaloriesBurned permissions in our AndroidManifest.xml:

... [other permissions]
<uses-permission android:name="android.permission.health.READ_TOTAL_CALORIES_BURNED"/>
<uses-permission android:name="android.permission.health.WRITE_TOTAL_CALORIES_BURNED"/>

which can lead to Google review rejection if we don't actually has a feature to utilise TotalCaloriesBurned (Excessive data access for declared feature). If we don't have those permissions added, we will get this error:

I/FLUTTER_HEALTH::ERROR(11781): Unable to return WORKOUT due to the following exception:
E/FLUTTER_HEALTH::ERROR(11781): java.lang.SecurityException: android.health.connect.HealthConnectException: java.lang.SecurityException: Caller doesn't have android.permission.health.READ_TOTAL_CALORIES_BURNED to read to record typeclass android.health.connect.datatypes.TotalCaloriesBurnedRecord

Reason

Why is this necessary:

Because some apps out there might not require to utilise this data.

Solution

Some apps out there might not utilise this data. So in order to solve this issue, we would need to make READ/WRITE_TOTAL_CALORIES_BURNED as optional in AndroidManifest.xml. This PR adds a condition to check if the permission is present and granted, otherwise will skip to calculate totalEnergyBurned.

Note: Once you merged this PR, ensure you don't have HealthDataType.TOTAL_CALORIES_BURNED or remove if it's present on your Flutter side implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant