cph-cachet / flutter-plugins

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

[Health: 8.1.0 - 9.0.1] The application crashes on Android 13 if there is no permission in Health Connect. #906

Open 88888888oleg opened 9 months ago

88888888oleg commented 9 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

The application crashes on Android 13 if there is no permission in Health Connect. If the application does not have permission to read data from Health Connect, then the application crashes when trying to obtain permissions (Auth button) and when trying to read data. There is no error data because the application simply crashes.

To Reproduce

Launch the application on Android 13 and try to get data or check Auth without permission from Health Connect.

Expected behavior

application works

Actual behavior

application crashes

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.16.9, on Ubuntu 23.10 6.5.0-17-generic, locale en_US.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Chrome - develop for the web [✓] Linux toolchain - develop for Linux desktop [✓] Android Studio (version 2023.1) [✓] Connected device (4 available) [✓] Network resources

jacobthecoder commented 8 months ago

We are experiencing this issue in our app. Any ETA on a fix? Thank you

Vrushti24 commented 5 months ago

What I did was downloaded Google fit from play store and added necessary permission so it stoped crashing

Android.manifest

<intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE" />
            </intent-filter>
var status = await Permission.activityRecognition.request();

request the permission it will work.