flutter-plugins
flutter-plugins copied to clipboard
[Health:3:1:0][Android] requestAuthorization always returns false
Device / Emulator and OS
Please complete the following information for each phone and/or emulator you're experiencing this bug on:
- Device: [Samsung A52]
- OS: [Android 11]
Describe the bug
I'm Using GoogleSignIn to login the user to the app, after that using the health plugin to request fit data. Calling the method requestAuthorization does nothing, it only returns false.
To Reproduce
Use GoogleSignIn in parallel with Health plugin, and call the method requestAuthorization after signing in the user.
Expected behavior
A pop with the required permission should appears to the user.
Actual behavior
No visual feedback or error throwing.
Flutter doctor
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5 20G71 darwin-x64, locale en-LB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2)
[✓] VS Code (version 1.56.2)
[✓] Connected device (2 available)
Additional information
After chasing the bug down, inside the Kotlin code the activity is always null. Also I'm using the permission for activity recognition.
I also faced this problem, but for me is on IOS . is always returns True https://github.com/cph-cachet/flutter-plugins/issues/397
Try adding test user in console because by default it allows workspace members only for testing but if you don't have any workspace then you must make app external and add some users for testing.
@sanjayApanchal : I always get: D/FLUTTER_HEALTH(31686): Access Denied!
. Added the OAuth and added the test user. Any suggestion? Using the latest version released (3.3.1
).
Try adding test user in console because by default it allows workspace members only for testing but if you don't have any workspace then you must make app external and add some users for testing.
That's fixed the issue for me, thank you.