Open codingjeremy opened 5 years ago
Comment by jeffreyfhow23 Thursday Jun 20, 2019 at 16:58 GMT
I've tried this but keep getting NullPointerException: Attempt to invoke interface method 'int com.google.android.gms.auth.api.signin.GoogleSignInOptionsExtension.getExtensionType()' on a null object reference
Hey,
so I was trying to achieve that user can easily log out from previously selected account and just using disableFit() or revokeAcess() didn't work. The only working solution that I found was doing like this:
val fitnessOptions = FitnessOptions.builder()
.build()
Fitness.getConfigClient(context, GoogleSignIn.getLastSignedInAccount(context))
.disableFit()
.continueWithTask {
val signInOptions = GoogleSignInOptions.Builder()
.addExtension(fitnessOptions)
.build()
GoogleSignIn.getClient(context, signInOptions)
.revokeAccess()
}
.addOnFailureListener { e ->
// receives error with no message and status code 4
}
Failure return status code with value 4 which is SIGN_IN_REQUIRED and next time when requesting permissions user is able to select an account.
Shouldn't just using disableFit achieve this result?
We have a similar issue. When a user disconnects the app from their Google Fit account (by going into Google Fit > Profile > Settings > Manage connected apps > [App Name] > DISCONNECT), the GoogleSignIn.hasPermissions
call still returns true. Shouldn't it return the current state of the user's profile?
We have a similar issue. When a user disconnects the app from their Google Fit account (by going into Google Fit > Profile > Settings > Manage connected apps > [App Name] > DISCONNECT), the
GoogleSignIn.hasPermissions
call still returns true. Shouldn't it return the current state of the user's profile?
I'm getting the same! Have you solved this?
I'm getting the same! Have you solved this?
No, I don't think we did. 👎
getting the same!
Same here, dont get why it is not an important issue.. I can see some apps doing some tricks to avoid the situation. Ui side they disconnect the user from google Fit, but they keep the connection in the google fit settings app..
@brianschrameck @Toubap you can add below on your AndroidManifest.xml that your app can auto logout from google when you disconnect the app from Google Fit App.
<service android:name="com.google.android.gms.auth.api.signin.RevocationBoundService" android:exported="true" android:permission="com.google.android.gms.auth.api.signin.permission.REVOCATION_NOTIFICATION" />
@maonaoda
you can add below on your AndroidManifest.xml that your app can auto logout from google when you disconnect the app from Google Fit App.
Supposedly it's already being included because we use play-services-auth:
This service is included automatically when depending upon com.google.android.gms:play-services-auth. There is no need to include it manually.
Getting the same, any updates?
Hi, everyone. I have a similar experience when the app requests three scopes for example
private val scopesArr = arrayOf(
Fitness.SCOPE_ACTIVITY_READ,
Fitness.SCOPE_NUTRITION_READ,
Fitness.SCOPE_BODY_READ
)
but the user grants permission to only one of them (ticks only one checkbox in the shown activity).
In that case when I check for permission like this:
GoogleSignIn.hasPermissions(acc, *scopesArr)
it returns true
it's year 2022, still the same issue
It's almost 2023 and still this hasn't been fixed. Guys I know that you're working on Health Connect ( and I really love that , I can't wait to integrate it ), but shouldn't this have to be addressed an fixed. If it has been already been fixed, which version should I use of :
com.google.android.gms:play-services-fitness
com.google.android.gms:play-services-auth
com.google.android.gms:play-services-base
To avoid the problem?
It's been years still nobody is looking at this critical issue.
I'm wondering what is the alternative solution to check if the GoogleAuth is disconnected? GoogleSignIn.requestPermissions
every time?
It is July 2023, and issue is still not resolved
Issue by norio-agoop Wednesday Mar 27, 2019 at 09:06 GMT Originally opened as https://github.com/googlesamples/android-fit/issues/48
Hi,
The situation
I'm trying to enable/disable google fit in my app with a Switch View.
When I turn off this switch, I call below code.
After
onSuccess
, I turn on switch to connect google fit and call below.Nothing happens because
GoogleSignIn.hasPermissions
always returntrue
.What I want to do
I'd like to check whether Google fit permission is granted or not before calling
GoogleSignIn.requestPermissions
Please tell me how to do this.
Thank you
Update
I think I have found a solution that disconnecting app through Google Fit App. After this,
GoogleSignIn.hasPermissions
return false. But I am curious how can do this programmatically.Solved
GoogleSignInClient.revokeAccess
works. I don't know the reasons why.Question
I'd like to ask you what is the diffrences between
Fitness.getConfigClient(context, account).disableFit()
andGoogleSignInClient.revokeAccess
?Thank you