Open REVBorislav opened 2 years ago
@REVBorislav, is workout data fetching working for ios for health 3.4.4?
@sunilk44 I get the following error when fetching data using version 3.4.4 E/MethodChannel#flutter_health( 1695): java.lang.IllegalArgumentException: Unsupported dataType: WORKOUT
.
Thanks.
@sunilk44 Hi, sorry, I kinda overlooked the ios part of your message. Health 3.4.4 does fetch workout data on ios.
@REVBorislav Hi, thanks for replying
Not working on Android for me as well. That's the entire reason why I updated
Any fix?
Any update?
^5.0.0 is the same. "The user must be signed in to make this API call."
There might be problem in documentation (README) which state "obtain client id and it should look like this", but there is no mention what to do with it. Where did you put it, @REVBorislav ?
P.S. My output looks like this, everything is "granted" but it fails anyway:
I/flutter (18317): Requesting permissions: location
I/flutter (18317): granted = true
I/flutter (18317): Requesting permissions: activity recognition
I/flutter (18317): granted = true
I/flutter (18317): Requesting access to data types: HealthDataType.ACTIVE_ENERGY_BURNED, HealthDataType.HEART_RATE, HealthDataType.HEIGHT, HealthDataType.STEPS, HealthDataType.WORKOUT, HealthDataType.DISTANCE_DELTA
I/flutter (18317): granted = true
W/FLUTTER_HEALTH::ERROR(18317): There was an error getting the data!
W/FLUTTER_HEALTH::ERROR(18317): 4: The user must be signed in to make this API call.
Update on my side: It started to work when I added support for Health Connect:
<queries>
<package android:name="com.google.android.apps.healthdata" />
<intent>
<action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE" />
</intent>
</queries>
... README presents this configuration as "optional" but it seems to be mandatory.
Unfortunately this doesn't solve the issue for me. I'm still getting the same error:
W/FLUTTER_HEALTH::ERROR( 2663): There was an error getting the workout data!
W/FLUTTER_HEALTH::ERROR( 2663): 4: The user must be signed in to make this API call.
W/FLUTTER_HEALTH::ERROR( 2663): [Ljava.lang.StackTraceElement;@8335037
The app is properly configured and I can read for example weight, blood pressure or glucose data from the Google service without troubles, but when I try to read a WORKOUT data, the error is thrown into debug.
The app is properly configured in the Google Cloud Console and all permissions are given which is also verifiable in the Google Fit app where my app is listed with all the required permissions including activities.
Funny thing is that after the error is thrown I'm not to read the weight data as well which was working perfectly fine before. The same error is thrown so I suppose that trying to read the workout data somehow logs out the authorized connection between the app and the service until the app is restarted.
@LarsRefsgaard I don't think is a misconfiguration.
[√] Flutter (Channel stable, 3.13.9, on Microsoft Windows [Version 10.0.22000.2538], locale pl-PL)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[√] Chrome - develop for the web
[√] Android Studio (version 3.2)
[√] Android Studio (version 2021.3)
[√] VS Code (version 1.84.1)
[√] Connected device (4 available)
[√] Network resources
It seems that the tip from this comment to another issue fix that: https://github.com/cph-cachet/flutter-plugins/issues/613#issuecomment-1358020301
So in order to read activities it is required to not only ask for HealthDataType.WORKOUT but also HealthDataType.DISTANCE_DELTA
This cause the Google Fit asks for localization permission but IMHO shouldn't. Our apps may need to just read activities without needing the localization (as mine does) data which users may consider private and don't allow the permission.
Unfortunately this doesn't solve the issue for me. I'm still getting the same error:
W/FLUTTER_HEALTH::ERROR( 2663): There was an error getting the workout data! W/FLUTTER_HEALTH::ERROR( 2663): 4: The user must be signed in to make this API call. W/FLUTTER_HEALTH::ERROR( 2663): [Ljava.lang.StackTraceElement;@8335037
The app is properly configured and I can read for example weight, blood pressure or glucose data from the Google service without troubles, but when I try to read a WORKOUT data, the error is thrown into debug.
The app is properly configured in the Google Cloud Console and all permissions are given which is also verifiable in the Google Fit app where my app is listed with all the required permissions including activities.
Funny thing is that after the error is thrown I'm not to read the weight data as well which was working perfectly fine before. The same error is thrown so I suppose that trying to read the workout data somehow logs out the authorized connection between the app and the service until the app is restarted.
@LarsRefsgaard I don't think is a misconfiguration.
[√] Flutter (Channel stable, 3.13.9, on Microsoft Windows [Version 10.0.22000.2538], locale pl-PL) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 32.0.0) [√] Chrome - develop for the web [√] Android Studio (version 3.2) [√] Android Studio (version 2021.3) [√] VS Code (version 1.84.1) [√] Connected device (4 available) [√] Network resources
I am unable to see why you're tagging me. I would probably reach out to @hoffmatteo , but no doubt he has seen this.
I''m sorry. I found you in some other issue as collaborator and decided to tag. Should be @hoffmatteo for sure.
Hi,
Could you please assist me with fetching workout data. I am running this issue on newer android versions, and one older ones the app just crashes.
Device
Description A clear and concise description of what the bug is. After trying to fetch wourkout data, I am given the following error:
I/FLUTTER_HEALTH::ERROR(19790): 4: The user must be signed in to make this API call. I/FLUTTER_HEALTH::ERROR(19790): [Ljava.lang.StackTraceElement;@db19cd5
Reproduce Using the given example code and steps from the pub.dev website.
Flutter doctor [✓] Flutter (Channel stable, 3.0.2, on macOS 12.4 21F79 darwin-x64, locale en-CZ) [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 13.4.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.2) [✓] VS Code (version 1.67.2) [✓] Connected device (3 available) [✓] HTTP Host Availability
• No issues found!
Thank you in advance.