krokyze / FitKit

Flutter plugin for reading health and fitness data. Wraps HealthKit on iOS and GoogleFit on Android.
BSD 2-Clause "Simplified" License
98 stars 73 forks source link

How to use this plugin. #4

Closed sai7 closed 5 years ago

sai7 commented 5 years ago

Hello!,

I have setup the plugin & at the launch of the app, readAll() is being called. I am selecting an google account & then User declined permission text appears. That's all. How to overcome this, please?

krokyze commented 5 years ago

Hey.

Could it be possible that you pressed "deny" the first time. I experienced this issue but haven't got time to search for solution. If user denies the permissions then GoogleSignIn.hasPermissions still returns true.

sai7 commented 5 years ago

No, @krokyze .

From the initial launch of the app, I am getting the same scenario. Even on other Android devices also, the same situation.:)

anilslabs commented 5 years ago

@sai7 You have to Enable Fitness API and obtain an OAuth 2.0 client ID first with the same package id you are using in your app.

krokyze commented 5 years ago

Yes as already @anil-sookshum answered, @sai7 did you completed this part https://developers.google.com/fit/android/get-api-key ?

sai7 commented 5 years ago

Yes , @krokyze. I have enabled google fit api for the same project.

But as @anil-sookshum mentioned, do I need to use the oauth 2.0 client ID in the app? That is not needed right? I have enabled the google fit api in the app using the same package id. Let me check once again and get back to you,

Thanks much m.

anilslabs commented 5 years ago

@sai7 have you added these dependencies in app level gradle file dependencies { ...... compile 'com.google.android.gms:play-services-fitness:16.0.1' compile 'com.google.android.gms:play-services-auth:16.0.1' }

For me it is working fine with above steps. Also check by logging in to with the same google account you are using for OAuth client id.

krokyze commented 5 years ago

@sai7 have you added these dependencies in app level gradle file dependencies { ...... compile 'com.google.android.gms:play-services-fitness:16.0.1' compile 'com.google.android.gms:play-services-auth:16.0.1' }

For me it is working fine with above steps. Also check by logging in to with the same google account you are using for OAuth client id.

Those dependencies are already in the Android part of the package so you don't have to add them on your project.

krokyze commented 5 years ago

@sai7 Yes you have to enable the Google Fit API and add your package id, that's it. The client id in app is not needed.

FatCat1411 commented 5 years ago

Hello, first of thank you for this package, I have some issue as people above, enabled Google Fit API and add package id, and I have success log in my google account, but the data return is empty. I can see datatype in logcat, such as heart_rate or step_count, but the data is empty. I have make sure that I have data on Google Fit using android app with the same name. Thank you very much. Ps: I have check my traffic on https://console.cloud.google.com/ and there wasn't any traffic.

ryanhz commented 5 years ago

I really don't know how to make it work in android. I do enable the Fitness API and also obtain an OAuth 2.0 client ID. But the ID is nowhere to use. There is a prompt for which Google account to use, but then just silent disappear, then no error, await FitKit.requestPermissions(DataType.values) just return false.

krokyze commented 5 years ago

If anyone still is having problems please open new issue.

Harshdeep4295 commented 4 years ago

@here I was facing the same issue... I just verified the package which I was using in flutter and the one which Is registered on google console. Both should be same