Reputation: 41
I'm developing with google fit api on Android. I setup my project followed the guide from google doc. But when I test auth on real device, it will show a white page with the loading sign after I select my google account like the image. It just loading forever and without any error.
Here is what I did in my project:
// AndroidManife
// because target API level 28
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
// google-services.json
"oauth_client": [
{
"client_id": "xxx-xxx.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "xxx.xxx.xxx",
"certificate_hash": "xxxxhash"
}
},
{
"client_id": "xxx-xxx.apps.googleusercontent.com",
"client_type": 3
}
]
// my auth activity, sample code from google doc
FitnessOptions fitnessOptions = FitnessOptions.builder()
.addDataType(DataType.TYPE_STEP_COUNT_DELTA, FitnessOptions.ACCESS_READ)
.addDataType(DataType.AGGREGATE_STEP_COUNT_DELTA, FitnessOptions.ACCESS_READ)
.build();
GoogleSignInAccount account = GoogleSignIn.getAccountForExtension(this, fitnessOptions);
if (!GoogleSignIn.hasPermissions(account, fitnessOptions)) {
GoogleSignIn.requestPermissions(
this, // your activity
GOOGLE_FIT_PERMISSIONS_REQUEST_CODE, // e.g. 1
account,
fitnessOptions);
}
OAuth 2.0 client ID is ok in Google API Console. I check the keystore SHA-1 is correct.
I also put my keystore SHA-1 in Firebase project settings.
Google sign in is opened in Firebase Authentication -> Sign-in Method.
What's I missed? What should I do? Please help me. Thanks very much.
Upvotes: 3
Views: 2693
Reputation: 31
if Your app is marked as "EXTERNAL" on "OAuth consent screen" - you need to add tester Users
Upvotes: 2
Reputation: 1160
For me, the problem was my project was marked as external in the oAuth Consent screen. In that case, you have to add a test user to continue using your google fit APIs in the application.
Upvotes: 0
Reputation: 41
I figure it out. It because I didn't edit my app name in Google API Console -> OAuth consent screen.
Upvotes: 1