How to disconnect an application from a Google Drive account

I connect my application through google play services - drive api. It works fine until I tried to unlink my Google user account. I found a way to use API Plus:

mApi = new GoogleApiClient.Builder(context)
    .addApi(Drive.API)
    .addApi(Plus.API)
    .addScope(Drive.SCOPE_APPFOLDER)
    .addConnectionCallbacks(this)
    .addOnConnectionFailedListener(this)
    .build();
...
...
Plus.AccountApi.clearDefaultAccount(mApi);
mApi.disconnect();

But it really didn't help me much. When I bind my application to Google Drive again, the intention to select an account is not displayed. (There is no Google Plus service in my account!)

Is there any other way to disconnect the application from the Google drive. I wonder why Drive :: DriveApi :: clearDefaultAccount does not exist?

Edit:

Well, like a workaround;

mApi.clearDefaultAccountAndReconnect();
mApi.disconnect();

This will clear the authentication data, and mApi.disconnect () will not allow Reconnect ... I still wonder if there is an elegant solution ...

+4
1

, clearDefaultAccount() clearDefaultAccountAndReconnect().

clearDefaultAccountAndReconnect() , Google Play . connect() , .

, , . ​​ revokeAccessAndDisconnect(GoogleApiClient).

: https://developer.android.com/reference/com/google/android/gms/plus/Account.html

, .

+3

Source: https://habr.com/ru/post/1568180/


All Articles