cph-cachet / flutter-plugins

A collection of Flutter plugins developed by CACHET
527 stars 625 forks source link

[Health 9.0.1] Android app crash on android 13 #907

Open harryandroiddev opened 4 months ago

harryandroiddev commented 4 months ago

Remember to specify the plugin name in the title!

Device / Emulator and OS

Describe the bug

When i use health connect on android 13 the app crashes when requesting for the permission .

To Reproduce

When trying to access permission the error occurs . HealthFactory health = HealthFactory(useHealthConnectIfAvailable: true); health. requestAuthorization

Expected behavior

app should not crash

Actual behavior

app is crashing

Flutter doctor

[✓] Flutter (Channel stable, 3.16.4, on macOS 13.0 22A8380 darwin-arm64, locale en-IN) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc2) [✓] Xcode - develop for iOS and macOS (Xcode 14.2) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.1) [✓] VS Code (version 1.86.2) [✓] Connected device (3 available) [✓] Network resources

Additional information

I/ViewRootImpl@5ec6f50MainActivity: ViewPostIme pointer 1 I/flutter (29069): >> trying to get permissions for [STEPS, BLOOD_GLUCOSE] with permissions [0, 0] I/FLUTTER_HEALTH(29069): Permission launcher not found I/flutter (29069): >> isAuthorized: false [healthconnect ] isavialable = true req false isgranted PermissionStatus.granted false E/AndroidRuntime(29069): FATAL EXCEPTION: main E/AndroidRuntime(29069): Process: com.example.health_app, PID: 29069 E/AndroidRuntime(29069): java.lang.SecurityException: com.example.health_app lacks the following permissions: [android.permission.health.READ_STEPS] E/AndroidRuntime(29069): at androidx.health.platform.client.impl.error.ErrorStatusConverterKt.toException(ErrorStatusConverter.kt:47) E/AndroidRuntime(29069): at androidx.health.platform.client.impl.ReadDataRangeCallback.onError(ReadDataRangeCallback.kt:35) E/AndroidRuntime(29069): at androidx.health.platform.client.service.IReadDataRangeCallback$Stub.onTransact(IReadDataRangeCallback.java:72) E/AndroidRuntime(29069): at android.os.Binder.execTransactInternal(Binder.java:1321) E/AndroidRuntime(29069): at android.os.Binder.execTransact(Binder.java:1280) E/AndroidRuntime(29069): Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@c094c5e, Dispatchers.Main] I/Process (29069): Sending signal. PID: 29069 SIG: 9 Lost connection to device.

Exited.

rafaellop commented 4 months ago

Same thing at my side. It seems that simultaneous calls to the requestAuthorization().

Dimoshka commented 3 months ago

Did you add to manifest permission "android.permission.health.READ_STEPS"?