Open louisdeveseleer opened 5 months ago
After further investigation, I was able to narrow down the precise issues:
This is because you are using workout , which under the hood request for total calories burned and distance .
This is the plugin native code for android
// Workout also needs distance and total energy burned too
if (typeKey == WORKOUT) {
if (access == 0) {
permList.addAll(
listOf(
HealthPermission.getReadPermission(
DistanceRecord::class
),
HealthPermission.getReadPermission(
TotalCaloriesBurnedRecord::class
),
),
)
} else {
permList.addAll(
listOf(
HealthPermission.getReadPermission(
DistanceRecord::class
),
HealthPermission.getReadPermission(
TotalCaloriesBurnedRecord::class
),
HealthPermission.getWritePermission(
DistanceRecord::class
),
HealthPermission.getWritePermission(
TotalCaloriesBurnedRecord::class
),
),
)
}
}
@harryandroiddev Thanks for sharing your insight! Do you know why "Distance" is automatically added for Workout, considering that many workout types don't involve any distance?
Device / Emulator and OS
Describe the bug
The permissions appearing in Health connect do not match the list of permissions passed to the plugin method
requestAuthorization
.Dart:
Android Manifest:
Health connect screen:
The "write" permissions in health connect do not include the ones that were requested, and the "read" permissions include all of them, although none was requested.
As a consequence:
hasPermissions
always returns false.To Reproduce
Ask for Write-only permissions.
Expected behavior
For Health connect to list the exact permissions requested, no more, no less.
Actual behavior
The permissions requested do not appear, and others that were not requested do appear.
Flutter doctor