I am using G+ login for my app.I have a option for user to disconnect g+ account.
case R.id.action_disconnect:
disconnectDialog = new ProgressDialog(this);
disconnectDialog.setMessage(getResources().getString(R.string.disconnect_dialog));
disconnectDialog.show();
googleApiClient = buildGoogleApiClient();
googleApiClient.connect();
private GoogleApiClient buildGoogleApiClient() {
return new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API, Plus.PlusOptions.builder().build())
.addScope(new Scope("email"))
.build();
}
public void onConnected(Bundle bundle) {
Plus.AccountApi.clearDefaultAccount(googleApiClient);
Plus.AccountApi.revokeAccessAndDisconnect(googleApiClient).setResultCallback(new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
googleApiClient.disconnect();
if (disconnectDialog != null)
disconnectDialog.dismiss();
accManager.Log();;
}
});
}
accManager.log return app to login screen.
Plus.AccountApi.clearDefaultAccount(googleApiClient)
; clears user account and I verified as I need to select account again when I click g+ login.
but Plus.AccountApi.revokeAccessAndDisconnect(googleApiClient)
does not revoke my app permission as when I click g+ login with same account only ask me to select account but does not ask for permission.
When I login as a new account app ask for my g+ permission
also uninstalling and reinstall
my app still keep my g+ permission. Does any guys meet this issue?Any help would be greatly appreciated. I followed https://developers.google.com/+/mobile/android/sign-in
I found my answer
buildGoogleApiClient should be
private GoogleApiClient buildGoogleApiClient() { return new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(Plus.API, Plus.PlusOptions.builder().build()) .addScope(Plus.SCOPE_PLUS_LOGIN) .addScope(new Scope("email")) .build(); }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.