Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[health 11.0] Requests incorrect permissions #1047

Open
traed opened this issue Sep 19, 2024 · 2 comments
Open

[health 11.0] Requests incorrect permissions #1047

traed opened this issue Sep 19, 2024 · 2 comments
Labels
bugfix a bug fix

Comments

@traed
Copy link

traed commented Sep 19, 2024

Device / Emulator and OS

Please complete the following information for each phone and/or emulator you're experiencing this bug on:

  • Device: Samsung Galaxy A05s
  • OS: Android 14

Describe the bug

When running Health().requestAuthorization with the types STEPS and WORKOUT only, the types TOTAL_CALORIES_BURNED and DISTANCE_WALKING_RUNNING are also requested. Since they are not specified in our list of types, Health().hasPermissions always returns false, prompting Health().requestAuthorization to run every time we want to access health data.

To Reproduce

const _types = [
  HealthDataType.STEPS,
  HealthDataType.WORKOUT
];

// Triggers a request for permissions including TOTAL_CALORIES_BURNED and DISTANCE_WALKING_RUNNING 
// which were not requested.
await Health().requestAuthorization(_types); 

// Returns false even though the requested permissions are granted. Presumably since it also (for some reason) checks
// TOTAL_CALORIES_BURNED and DISTANCE_WALKING_RUNNING which were granted but not saved.
await Health().hasPermissions(_types);

Expected behavior

Only the specified permissions should be requested.

Actual behavior

TOTAL_CALORIES_BURNED and DISTANCE_WALKING_RUNNING are requested even if not specified.

Flutter doctor

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.6.1 23G93 darwin-arm64, locale en-SE)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.93.1)
[✓] Connected device (5 available)
[✓] Network resources

• No issues found!

Additional information

According to the data types table, DISTANCE_WALKING_RUNNING isn't even supported on Android, but it's still requested. Why?

@traed traed added the bugfix a bug fix label Sep 19, 2024
@ciriousjoker
Copy link
Contributor

Out app was just rejected from Google because it requires these permissions that are technically not required.

@Aqitaniya
Copy link

On the IOS the same issue await Health().hasPermissions([HealthDataType.BLOOD_GLUCOSE], permissions: [HealthDataAccess.WRITE]) always return false when in settings allowed. IOS 17.6.1 iPhone 13 mini

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix a bug fix
Projects
None yet
Development

No branches or pull requests

3 participants