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.0 cannot requestAuthorization for write workout without including extra read permissions #1056

Open
Olster1 opened this issue Oct 8, 2024 · 0 comments
Labels
bugfix a bug fix

Comments

@Olster1
Copy link

Olster1 commented Oct 8, 2024

health 11.0.0

Device / Emulator and OS

Google Pixel 6 - Android

Describe the bug

I'm calling requestAuthorization with WORKOUT & WRITE . It only returns true if I also include READ_EXERCISE, READ_DISTANCE, READ_TOTAL_CALORIES_BURNED & READ_ACTIVE_CALORIES_BURNED in my Android Manifest. But am not asking to read anything.

List<HealthDataType> types = [
      HealthDataType.WORKOUT
    ];
    List<HealthDataAccess> permissions = [
      HealthDataAccess.WRITE,
    ];

    bool requested = await Health()
        .requestAuthorization(types,
            permissions: permissions);

ANDROID Manifest - have to include all these to get it to return true.

 <uses-permission android:name="android.permission.health.READ_EXERCISE"/>
<uses-permission android:name="android.permission.health.READ_DISTANCE"/> 
<uses-permission android:name="android.permission.health.READ_TOTAL_CALORIES_BURNED"/> 
    <uses-permission android:name="android.permission.health.READ_ACTIVE_CALORIES_BURNED"/>

    <uses-permission android:name="android.permission.health.WRITE_EXERCISE"/>
    <uses-permission android:name="android.permission.health.WRITE_DISTANCE"/>
    <uses-permission android:name="android.permission.health.WRITE_TOTAL_CALORIES_BURNED"/>
    <uses-permission android:name="android.permission.health.WRITE_ACTIVE_CALORIES_BURNED"/>

To Reproduce

call requestAuthorization with the type & permission WORKOUT & WRITE. If You do not include READ_EXERCISE, READ_DISTANCE, READ_TOTAL_CALORIES_BURNED, READ_ACTIVE_CALORIES_BURNED, WRITE_EXERCISE, WRITE_DISTANCE, WRITE_TOTAL_CALORIES_BURNED & WRITE_TOTAL_CALORIES_BURNED it will return false.

Expected behavior

I expect to only include WRITE_EXERCISE, WRITE_DISTANCE, WRITE_TOTAL_CALORIES_BURNED & WRITE_TOTAL_CALORIES_BURNED in my android manifest.

@Olster1 Olster1 added the bugfix a bug fix label Oct 8, 2024
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

1 participant