cph-cachet / flutter-plugins

A collection of Flutter plugins developed by CACHET
554 stars 681 forks source link

[health: ^10.2.0] Error: There was an error getting the total steps in the interval! #976

Open aruns2896 opened 5 months ago

aruns2896 commented 5 months ago

Health

Device

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

Describe the bug

I was able to fetch the data for the first time through Health Connect and after that, when I closed my app and reopened the error came

W/FLUTTER_HEALTH::ERROR( 8417): There was an error getting the total steps in the interval! W/FLUTTER_HEALTH::ERROR( 8417): 4: The user must be signed in to make this API call. W/FLUTTER_HEALTH::ERROR( 8417): [Ljava.lang.StackTraceElement;@562665d

int? steps = await healthFactory.getTotalStepsInInterval(currentDate, currentDate.add(Duration(hours: 23, minutes: 59, seconds: 59)));

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 3.19.0, on Microsoft Windows [Version 10.0.22631.3593], locale en-IN) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [√] Chrome - develop for the web [X] Visual Studio - develop Windows apps [√] Android Studio (version 2023.3) [√] VS Code (version 1.89.1) [√] Connected device (4 available) ! Device emulator-5554 is offline. [√] Network resources

! Doctor found issues in 1 category.

anasboyka commented 4 months ago

did u fix the problem yet?

yogeshButani commented 4 months ago

hii @aruns2896, I have also integrated health connect with this package in the app.On IOS devices, all is working good, but when comes to android devices(any) its showing alawys zero steps. if i add data manually thourgh the same code, then it successfully added to the steps, but it can not be able to read steps when we start taking steps. please tell us what is the issue.

is there any conditions from the health connect side is that, app need to be live on play store to use health connect or something like that?

SlimShadyIAm commented 3 months ago

@aruns2896 Are you calling Health().configure();? The error you provided seems to be related to Google Fit.

if your intention is to use Health Connect, you need to call Health().configure(useHealthConnectIfAvailable: true); when the app starts.