flutter-plugins
flutter-plugins copied to clipboard
[Health 10.2.0] Health connect permissions don't match what is asked
Device / Emulator and OS
- Device: Pixel 7
- OS: Android 14
Describe the bug
The permissions appearing in Health connect do not match the list of permissions passed to the plugin method requestAuthorization
.
Dart:
final types = [
HealthDataType.WEIGHT,
HealthDataType.HEIGHT,
HealthDataType.WORKOUT,
HealthDataType.ACTIVE_ENERGY_BURNED,
];
final permissions = [
HealthDataAccess.WRITE,
HealthDataAccess.WRITE,
HealthDataAccess.WRITE,
HealthDataAccess.WRITE,
];
await health.requestAuthorization(types, permissions: permissions);
Android Manifest:
<uses-permission android:name="android.permission.health.WRITE_HEIGHT"/>
<uses-permission android:name="android.permission.health.WRITE_WEIGHT"/>
<uses-permission android:name="android.permission.health.WRITE_EXERCISE"/>
<uses-permission android:name="android.permission.health.WRITE_ACTIVE_CALORIES_BURNED"/>
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:
- 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!