The health.requestAuthorization call is frozen, while if you execute health.hasPermissions you will see that access to datapoints is available.
To Reproduce
Example project:
Future authorize() async {
// If we are trying to read Step Count, Workout, Sleep or other data that requires
// the ACTIVITY_RECOGNITION permission, we need to request the permission first.
// This requires a special request authorization call.
//
// The location permission is requested for Workouts using the Distance information.
await Permission.activityRecognition.request();
await Permission.location.request();
// Check if we have permission
bool? hasPermissions =
await health.hasPermissions(types, permissions: permissions);
// hasPermissions = false because the hasPermission cannot disclose if WRITE access exists.
// Hence, we have to request with WRITE as well.
hasPermissions = false;
bool authorized = false;
if (!hasPermissions) {
// requesting access to the data types before reading them
try {
authorized =
await health.requestAuthorization(types, permissions: permissions);
debugPrint('_HealthAppState.fetchStepData !!!!!!!!!!!!!!!!!!');
} catch (error) {
print("Exception in authorize: $error");
}
}
setState(() => _state =
(authorized) ? AppState.AUTHORIZED : AppState.AUTH_NOT_GRANTED);
}
Expected behavior
The call will terminate with the result of the execution
Actual behavior
The call is freezing
Screenshots
Not applicable
Flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.4, on macOS 13.0.1 22A400 darwin-arm64, locale ru-IL)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.3.1)
[✓] Connected device (4 available)
[✓] Network resources
• No issues found!
➜ longevity_connect flutter doctor -v
[✓] Flutter (Channel stable, 3.16.4, on macOS 13.0.1 22A400 darwin-arm64, locale ru-IL)
• Flutter version 3.16.4 on channel stable at /Users/iosiffuterman/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2e9cb0aa71 (13 days ago), 2023-12-11 14:35:13 -0700
• Engine revision 54a7145303
• Dart version 3.2.3
• DevTools version 2.28.4
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/iosiffuterman/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14B47b
• CocoaPods version 1.12.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] IntelliJ IDEA Ultimate Edition (version 2023.3.1)
• IntelliJ at /Applications/IntelliJ IDEA 2.app
• Flutter plugin version 77.0.1
• Dart plugin version 233.11799.172
Remember to specify the plugin name in the title!
Device / Emulator and OS
Please complete the following information for each phone and/or emulator you're experiencing this bug on:
NB: Bugs pertaining to old devices/OS versions will likely not be fixed.
Describe the bug
The health.requestAuthorization call is frozen, while if you execute health.hasPermissions you will see that access to datapoints is available.
To Reproduce
Expected behavior
The call will terminate with the result of the execution
Actual behavior
The call is freezing
Screenshots
Not applicable
Flutter doctor
Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.16.4, on macOS 13.0.1 22A400 darwin-arm64, locale ru-IL) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 14.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.1) [✓] IntelliJ IDEA Ultimate Edition (version 2023.3.1) [✓] Connected device (4 available) [✓] Network resources
• No issues found! ➜ longevity_connect flutter doctor -v [✓] Flutter (Channel stable, 3.16.4, on macOS 13.0.1 22A400 darwin-arm64, locale ru-IL) • Flutter version 3.16.4 on channel stable at /Users/iosiffuterman/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 2e9cb0aa71 (13 days ago), 2023-12-11 14:35:13 -0700 • Engine revision 54a7145303 • Dart version 3.2.3 • DevTools version 2.28.4
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/iosiffuterman/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14B47b • CocoaPods version 1.12.1
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2023.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.3.1) • IntelliJ at /Applications/IntelliJ IDEA 2.app • Flutter plugin version 77.0.1 • Dart plugin version 233.11799.172
[✓] Connected device (4 available) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator) • iPhone 14 Pro (mobile) • 5D83F457-1F37-4AE2-AFFA-0871066EF353 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-1 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.0.1 22A400 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 120.0.6099.129
[✓] Network resources • All expected network resources are available.
• No issues found!
Additional information
Add any other info about the problem here.