fit-samples icon indicating copy to clipboard operation
fit-samples copied to clipboard

GoogleSignIn.getLastSignedInAccount for google fit api ALWAYS prompt account selection

Open codingjeremy opened this issue 6 years ago • 1 comments

Issue by ykorshev Monday Jan 07, 2019 at 04:41 GMT Originally opened as https://github.com/googlesamples/android-fit/issues/44


I have an app which uses Google Fit. The integration code has been copied from google documentation: if (!GoogleSignIn.hasPermissions(GoogleSignIn.getLastSignedInAccount(this), fitnessOptions)) { GoogleSignIn.requestPermissions( this, // your activity GOOGLE_FIT_PERMISSIONS_REQUEST_CODE, GoogleSignIn.getLastSignedInAccount(this), fitnessOptions); } else { accessGoogleFit(); } In the debug mode, everything works fine, but when my app downloaded from Google Play, it ALWAYS display a prompt for selecting the google account to use: image The problem appears only when app downloaded from google play. When app installed with adb, everything works fine.

It seems like, Google Play Services does not cache last selected account.

Please help me, where is the issue here?

codingjeremy avatar Sep 10 '19 20:09 codingjeremy

Maybe you didn't add an OAuth client id with the SHA-1 of release certificate? See https://developers.google.com/fit/android/get-api-key

mlazari avatar Sep 12 '19 09:09 mlazari