I have an app that needs to access Google Fit Api.
I can get the google sign-in pop up. But the next screen, requesting permission for my data types (TYPE_STEP_COUNT_DELTA, AGGREGATE_STEP_COUNT_DELTA) is not displayed.
As soon as I choose my google account the pop-up goes away and nothing is displayed further.
I have followed all the steps for the Setup mentioned here https://developers.google.com/fit/android/get-started
Set up my project in Google API developer console
Install google play services packages in my android studio
Add the dependencies
dependencies {
implementation 'com.google.android.gms:play-services-fitness:20.0.0'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
}
- Enable sign-in options "google" in my firebase console
Yet I do not get the further screens.
My code is as below:
public void setFitnessOption() {
fitnessOptions =
FitnessOptions.builder()
.addDataType(DataType.TYPE_STEP_COUNT_DELTA, FitnessOptions.ACCESS_READ)
.addDataType(DataType.AGGREGATE_STEP_COUNT_DELTA, FitnessOptions.ACCESS_READ)
.build();
}
public void checkFitInstalled() {
if (isGoogleFitPermissionGranted()) {
GetData(); //step count query
} else {
requestGoogleFitPermission();
GetData(); //step count query
}
}
public boolean isGoogleFitPermissionGranted() {
if (GoogleSignIn.hasPermissions(GoogleSignIn.getLastSignedInAccount(this), fitnessOptions)) {
return true;
} else {
return false;
}
}
public void requestGoogleFitPermission() {
GoogleSignInAccount account = GoogleSignIn.getAccountForExtension(this, fitnessOptions);
GoogleSignIn.requestPermissions(
this,
GOOGLE_FIT_PERMISSIONS_REQUEST_CODE,
account,
fitnessOptions);
}
What am I missing out?? struggling for days with this issue. Any input would be great!!!

