Reputation: 425
I am developing an application in Flutter, which retrieves podometric data through Apple Health and Google Fit. Apple Health is correctly configured. Google Fit does not work. The application asks for access to the data, it opens the pop up select an account then nothing happens, and the value returned corresponding to the access is false.
I am using the : health: ^3.0.3
I am requesting access like this:
DateTime endDate = DateTime.now();
DateTime startDate =
widget.user.lastTimeRecoverHealthData.add(Duration(seconds: 1));
HealthFactory health = HealthFactory();
List<HealthDataType> types = [
HealthDataType.STEPS,
HealthDataType.DISTANCE_WALKING_RUNNING,
];
List<HealthDataPoint> healthData;
health.requestAuthorization(types).then((value) {
print("health.requestAuthorization: THEN");
print("then return ${value}");
if (value) {
[...]
}
})
I can't find where I miss a step in the Google fit and Android process. Any help is welcome.
Upvotes: 1
Views: 1971
Reputation: 41
FINALLY GOT THIS ISSUE SOLVED!!
So the problem doesn't lie in the version I am using 3.4.0 but still got the problem solved
Authorization not granted. And stuck in loading screen
Stuck in authorization request screen
When you create your OAuth 2.0 consent screen try to add at least 2 email addresses to the TEST USER section and make sure to login from that emails.
[Add 2 email addresses in Test User]2
After that make sure to verify your application from Google, it will work until you test your app once you release the application, it will not work
Verify Your Application from Google
Final Result 4
Upvotes: 0
Reputation: 672
You have to make sure the package name you registered to your project on Google Cloud Platform is matched with the package name from the app you are develop.
Check the OAuth 2.0 Client IDs from Credentials on your Google Cloud Console. I ran into same problem you described and my mistake was the name from the Credentials is was not match with my app's package name.
Upvotes: 1