目录

Signing Out of an ID

Use Case

After signing in to an app using an ID, the user can sign out of the ID as needed. After the user signs out, the app will notify the account SDK to clear the user's ID information.

Supported Devices

Device Type

OS Version

HMS Core (APK) Version

Phone, tablet, HUAWEI Vision, and telematics device

EMUI 3.0 or later and Android 4.4 or later

4.0.0.300 or later

Service Process

The process is described as follows:

  1. A user has signed in to your app and attempts to sign out.
  2. Your app calls the AccountAuthService.signOut method to request the account SDK to sign the user out.
  3. The account SDK deletes the sign-in information of the user and sends the sign-out result to your app.

Development Procedure

The key steps for developing the sign-out function are as follows:

  1. Call the signOut API using the AccountAuthService instance that is created during the ID sign-in authorization.
    Java
    Task<Void> signOutTask = service.signOut();
    Kotlin
    val signOutTask = service.signOut()
  2. Perform processing after the sign-out is complete.
    Java
    signOutTask.addOnCompleteListener(new OnCompleteListener<Void>() {
        @Override
        public void onComplete(Task<Void> task) {
            // Processing after the sign-out.
            Log.i(TAG, "signOut complete");
        }
    });
    Kotlin
    signOutTask.addOnCompleteListener { it ->
        // Processing after the sign-out.
        Log.i(TAG, "signOut complete")
    }