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();
}
On Friday, June 5, 2015 at 11:10:21 AM UTC+8, kevin0228ca wrote:
>
> Hi,
>
> 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.
>
> anyone know? I followed
> https://developers.google.com/+/mobile/android/sign-in
>
> Thank you.
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.