flutter-plugins icon indicating copy to clipboard operation
flutter-plugins copied to clipboard

health: 3.0.5

Open rashmitank opened this issue 3 years ago • 58 comments

getting Authorization not granted in your example project. I have properly set an OAuth2 Client ID.

rashmitank avatar Apr 14 '21 12:04 rashmitank

I'm facing same problem on my apps..

takinok avatar Apr 14 '21 13:04 takinok

I also have the same problem. HELP!!

yamachaso avatar Apr 19 '21 17:04 yamachaso

I've been having the same problem, the plugin doesnt ask the permission for GOOGLE_FIT_PERMISSIONS_REQUEST_CODE but directly print "Authorization not granted".

JNicoVM avatar Apr 21 '21 20:04 JNicoVM

The same issue.

AntonFesun avatar Apr 22 '21 15:04 AntonFesun

Me too. I also have the same issue.

4tech-long avatar Apr 25 '21 09:04 4tech-long

same here, need to be fixed asap

asmodeoux avatar Apr 25 '21 19:04 asmodeoux

I have same issue please resolve it

ktech643 avatar Apr 28 '21 21:04 ktech643

I've debugged the health plugin. This is my first try to debug the flutter package. So, it won't be enough investigation. But I want share what I know and I did following.

  • The cause of problem seems to be that "activity" is null.
    private fun requestAuthorization(call: MethodCall, result: Result) {
        if (activity == null) {
            result.success(false)
            return
        }
  • The "activity" variable should be initialized by "onAttachedToActivity". "onAttachedToActivity" is called after "onAttachedToFlutterEngine", according to this article.
  • Unfortunately, I cloud not catch process on "onAttachedToActivity" and "onAttachedToFlutterEngine" by debug mode somehow...
override fun onAttachedToActivity(binding: ActivityPluginBinding) {
        if (channel == null) {
            return
        }
        binding.addActivityResultListener(this)
        activity = binding.activity
    }

takinok avatar May 01 '21 11:05 takinok

I need to get the step count from google fit to my application when I tried the example it shows that Authorization not granted

[ /// You MUST request access to the data types before reading them bool accessWasGranted = await health.requestAuthorization(types); ] this bool value sets false

I tried to get the activity recognition permission by activity_recognition_flutter: ^4.0.0

In the app info it shows the permission was granted but still facing the same issue

I cannot find where the problem occurs if any contributors know something about it or any other procedure missed please instruct us and help us to use this feature

chanakiyan avatar May 07 '21 04:05 chanakiyan

Hi, What is "activity"? This variable is always null, therefore the following condition is always true: image oraz image

mniemyjski avatar May 08 '21 15:05 mniemyjski

We can use v3.0.4 as workaround.

takinok avatar May 10 '21 06:05 takinok

I also have the same issue.

AntonSavelev avatar May 10 '21 14:05 AntonSavelev

We can use v3.0.4 as workaround.

can you explain it more how we can get around issue

bhargav6744 avatar May 11 '21 13:05 bhargav6744

getting Authorization not granted in your example project. I have properly set an OAuth2 Client ID.

Did you get any solution?

sandeep9607 avatar May 11 '21 15:05 sandeep9607

We can use v3.0.4 as workaround.

can you explain it more how we can get around issue

sorry for my rough comment. what I mean we can use the health v.3.0.4 temporarily until this issue is fixed.

<pubspec.yaml>
health: 3.0.4

takinok avatar May 12 '21 13:05 takinok

Another alternative is to use the #338 branch, before it is merged.

<pubspec.yaml>
  health:
    git:
      url: https://github.com/traveling-developer/flutter-plugins.git
      path: packages/health
      ref: health-3.0.3+1

patrickkusebauch avatar May 15 '21 14:05 patrickkusebauch

@patrickkusebauch it;'s not working. ?When tap on download button the google sign-in dialog open and then click on account it return with same error "Authorization not granted"

himanshu447 avatar May 18 '21 13:05 himanshu447

@himanshu447 Just the fact that the google sign-in dialog will open means it is working. The follow-up error you are having seems unrelated to the original issue. You might have forgotten to actually set up the proper permissions. The setup I have described is working for me on an emulator as well as on an actual android device. Admittedly I have not tested it on an iOS device.

patrickkusebauch avatar May 18 '21 13:05 patrickkusebauch

Hello @patrickkusebauch Google sign-in popup open for me as well, but after choosing account it return error "Authorization not granted", handleWindowVisibility: no activity .... I guess this is reason for auth fail. isn't it? WhatsApp Image 2021-05-21 at 6 06 29 PM

swiftdev69 avatar May 25 '21 03:05 swiftdev69

getting Authorization not granted in your example project. I have properly set an OAuth2 Client ID.

I am having same issue. But where did you set the OAuth2 Client ID? I don't receive any Google Sign-In dialog. It goes straight to "Authorization not granted"

waikyaw9999 avatar May 25 '21 06:05 waikyaw9999

Hello @waikyaw9999 https://github.com/cph-cachet/flutter-plugins/issues/336#issuecomment-841665698 . But where did you set the OAuth2 Client ID? I also want to know

sandeep9607 avatar May 25 '21 06:05 sandeep9607

Hello @waikyaw9999 #336 (comment) . But where did you set the OAuth2 Client ID? I also want to know

@sandeep9607 I followed your instruction. Now it showed me Google Sign-In Dialog but after I clicked on my google account. I am now stuck at the permission dialog box (I don't see anything but the google loading circle). I didn't set anywhere the OAuth2 Client ID.

waikyaw9999 avatar May 25 '21 07:05 waikyaw9999

@himanshu447 Just the fact that the google sign-in dialog will open means it is working. The follow-up error you are having seems unrelated to the original issue. You might have forgotten to actually set up the proper permissions. The setup I have described is working for me on an emulator as well as on an actual android device. Admittedly I have not tested it on an iOS device.

Do you have any example about setting up the proper permission. I am having the same issue.

waikyaw9999 avatar May 27 '21 07:05 waikyaw9999

@himanshu447 Just the fact that the google sign-in dialog will open means it is working. The follow-up error you are having seems unrelated to the original issue. You might have forgotten to actually set up the proper permissions. The setup I have described is working for me on an emulator as well as on an actual android device. Admittedly I have not tested it on an iOS device.

Do you have any example about setting up the proper permission. I am having the same issue.

Hi, it is working now. I set the wrong package name. #336 (comment) is working. When is it going to be in the release? I should mention that version 3.0.6 is still not working though. [Updated] This doesn't work on production as getting conflict with other packages.

waikyaw9999 avatar May 28 '21 02:05 waikyaw9999

I have the same Problem. None of the solutions are working for me

riobijanero avatar May 29 '21 14:05 riobijanero

I have the same Problem. None of the solutions are working for me

https://github.com/cph-cachet/flutter-plugins/issues/336#issuecomment-839795664 This works for me.

waikyaw9999 avatar May 29 '21 14:05 waikyaw9999

I have the same Problem. None of the solutions are working for me

https://github.com/cph-cachet/flutter-plugins/issues/336#issuecomment-839795664 This works for me.

hey @waikyaw9999 , thanks for the reply. however the link leads to an empty github page

riobijanero avatar May 29 '21 16:05 riobijanero

Oh. you can use health:3.0.4 > > > I have the same Problem. None of the solutions are working for me

https://github.com/cph-cachet/flutter-plugins/issues/336#issuecomment-839795664 This works for me.

hey @waikyaw9999 , thanks for the reply. however the link leads to an empty github page

waikyaw9999 avatar May 30 '21 00:05 waikyaw9999

@waikyaw9999 @takinok which flutter version you guys working with?

sandeep9607 avatar Jun 03 '21 13:06 sandeep9607

@waikyaw9999 @takinok which flutter version you guys working with?

Follwing is my version.


Flutter 2.0.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision adc687823a (7 weeks ago) • 2021-04-16 09:40:20 -0700 Engine • revision b09f014e96 Tools • Dart 2.12.3

takinok avatar Jun 07 '21 03:06 takinok