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:
the necessary permissions are not enabled, which leads to failed writes to health connect.
the method 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
[✓] Flutter (Channel stable, 3.22.2, on macOS 14.5 23F79 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.90.1)
[✓] Connected device (4 available)
[✓] Network resources
• No issues found!
After further investigation, I was able to narrow down the precise issues:
On the device Pixel 7 (Android 14, sdk 34), there are extra permissions asked (which lead to hasPermission returning false), but we can still write data as needed.
On an older device (Nokia 6.1, Android 10, sdk 29), the Health plugin version 10.2.0 fails to write any data. After many attempts to make things work, I had to revert to Health version 9.0.1 to be able to restore the data writes.
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