# Signing Out Users and Disconnecting Accounts

> [!WARNING]
> **Warning:** Google Sign-In for Android is outdated and no longer supported. To ensure the continued security and usability of your app, [migrate
> to Credential Manager](https://developer.android.com/training/sign-in/credential-manager/) today. Credential Manager supports passkey, password, and federated identity authentication (such as Sign-in with Google), stronger security, and a more consistent user experience. For Wear developers: Credential Manager will be supported in Wear OS 5.1 and later on selected watches. Developers actively supporting Wear OS 3, 4 and 5.0 devices with Sign in with Google should continue using Google Sign-in for Android for your Wear applications. Sign in with Google support will be available on Credential Manager APIs for these versions of WearOS at a later date.

You can enable your users to sign out of your app, and to disconnect their
accounts from your app entirely.

## Sign out users

To add a sign out button to your app, first create a button in your app to act
as your sign out button. Then, attach an
[`onClickListener`](https://developer.android.com/reference/android/view/View.OnClickListener.html)
to the button and configure the `onClick` method to call
[`signOut`](https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInClient#signOut()).

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            // ...
            case R.id.button_sign_out:
                signOut();
                break;
            // ...
        }
    }

```
private void signOut() {
    mGoogleSignInClient.signOut()
            .addOnCompleteListener(this, new OnCompleteListener<Void>() {
                @Override
                public void onComplete(@NonNull Task<Void> task) {
                    // ...
                }
            });
}
```

This code clears which account is connected to the app. To sign in again, the
user must choose their account again.

## Disconnect accounts

It is highly recommended that you provide users that signed in with Google the
ability to disconnect their Google account from your app. If the user deletes
their account, you must delete the information that your app obtained from the
Google APIs.

The following code shows a simple example of calling the
[`revokeAccess`](https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInClient#revokeAccess())
method:

```
private void revokeAccess() {
    mGoogleSignInClient.revokeAccess()
            .addOnCompleteListener(this, new OnCompleteListener<Void>() {
                @Override
                public void onComplete(@NonNull Task<Void> task) {
                    // ...
                }
            });
}
```

In the completion listener, you can respond to the event and trigger any
appropriate logic in your app or your back-end code.