cph-cachet / flutter-plugins

A collection of Flutter plugins developed by CACHET
527 stars 625 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 1 month ago

takashi11171117 commented 1 month 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 1 month 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 1 month 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 1 month 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.