cph-cachet / flutter-plugins

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

[Health 10.2.0] Can not access health connect by only AppStore released app in Android version below 13 #958

Open takashi11171117 opened 6 months ago

takashi11171117 commented 6 months ago

Device / Emulator and OS

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

Describe the bug

I am using the package for only getting step count in my flutter app. When I called requestAuthorization method of health package somewhere with useHealthConnectIfAvailable, I got this error by only PlayStore released app in Android version below 13. (My app can run it by PlayStore released app in Android14 and local release builded app in Android below 13 ) This app can't access Health Connect like the link

The Link wrote Apps currently need to be allowlisted to get access to Health Connect. You can follow the process outlined at: https://developer.android.com/guide/health-and-fitness/health-connect/frequently-asked-questions#q_how_do_i_request_access_to_readwrite_data_types

But I have approved the allowlist.

To Reproduce

Steps to reproduce the behavior - Write code according to the10.2.0 of health package and release PlayStore. Then call requestAuthorization method of health package somewhere.

Expected behavior

I want to prevent the dialog This app can't access Health Connect from appearing.

Actual behavior

I tried to catch a exception of requestAuthorization method by a log tool. But I could not get nothing.

Flutter doctor

[✓] Flutter (Channel stable, 3.19.3, on macOS 14.2.1 23C71 darwin-arm64, locale ja-JP) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.3) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.2) [✓] VS Code (version 1.88.1) [✓] Connected device (2 available) [✓] Network resources

tantzygames commented 6 months ago

Here is more information about the message you're getting: https://developer.android.com/health-and-fitness/guides/health-connect/publish/request-access

Have you submitted this request form and been given permission to access Health Connect from Google? https://docs.google.com/forms/d/1LFjbq1MOCZySpP5eIVkoyzXTanpcGTYQH26lKcrQUJo/viewform?edit_requested=true

takashi11171117 commented 6 months ago

@tantzygames Thanks!, I was approved the request form. And My app can get step count in Android 14. I applied getting step permission.

I need only step count and I wrote this line in AndroidManifest. <uses-permission android:name="android.permission.health.READ_STEPS"/>

tantzygames commented 6 months ago

I had to make some changes to get it working on Android 14 which have stopped it working properly on 13 and lower. I think we still need the flutter_health_connect for 13 and lower even though it crashes in 14. I will stop hijacking your issue.

yogeshButani commented 4 months ago

hello, i have user health package in flutter to get the steps count. package link :- https://pub.dev/packages/health This package helps to retrieve the health data directly to health connect in android and apple health from IOS. On IOS devices it's working good, taking data from apple health successfully but when comes in android, its always showing 0 steps, i have all the setup for Android, even not getting any type of error still showing 0 steps don't know why...all permissions are enabled, app is also showing inside health connect settings on device...don't know how the issue is occurring.

We have checked health connect on device settings that all permissions are allowed for the application which using health connect, still showing zero step count on the app.

If we write data manually from the app itself for the steps taken that its already showing inside health and access of health connect, but when when we takes steps physically then it not showing the data. returning 0 steps always.

We have checked the on different android versions, still same issue persists.

yogeshButani commented 4 months ago

hii @tantzygames @takashi11171117 Is this is compulsory to use health connect is that, the app should be live in play store? we can not use health connect in development phase or without making app live to play store.? please reply.

takashi11171117 commented 4 months ago

@yogeshButani I think Health Connect can use at the app what is not PlayStore app. When I tested, I could use it in local release or dev app.

But I could not use it of PlayStore app below android13 devices.

yogeshButani commented 3 months ago

hii @takashi11171117 Can you please share full code of how you integrated steps in your flutter project with manifest.xml/build.gradle, I also get the request approved from the health connect to read steps count. Still not able to fetch steps from health connect, on IOS its working fine with apple health