# AuthTabCallback

Artifact: [androidx.browser:browser](https://developer.android.com/jetpack/androidx/releases/browser) [View Source](https://cs.android.com/search?q=file:androidx/browser/auth/AuthTabCallback.java+class:androidx.browser.auth.AuthTabCallback) Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

*** ** * ** ***

<br />

```
public interface AuthTabCallback
```

<br />

*** ** * ** ***

A callback class for Auth Tab clients to get messages regarding events in their Auth Tabs. In the implementation, all callbacks are sent to the `https://developer.android.com/reference/java/util/concurrent/Executor.html` provided by the client to `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#newAuthTabSession(androidx.browser.auth.AuthTabCallback,java.util.concurrent.Executor)` or its UI thread if one is not provided.

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/browser/auth/AuthTabCallback#onExtraCallback(java.lang.String,android.os.Bundle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html callbackName, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html args)` Unsupported callbacks that may be provided by the implementation. |
| `abstract @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/browser/auth/AuthTabCallback#onExtraCallbackWithResult(java.lang.String,android.os.Bundle)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html callbackName, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html args )` The same as `https://developer.android.com/reference/androidx/browser/auth/AuthTabCallback#onExtraCallback(java.lang.String,android.os.Bundle)`, except that this method allows the Auth Tab provider to return a result. |
| `abstract void` | `https://developer.android.com/reference/androidx/browser/auth/AuthTabCallback#onNavigationEvent(int,android.os.Bundle)(int navigationEvent, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html extras)` To be called when a navigation event happens. |
| `abstract void` | `https://developer.android.com/reference/androidx/browser/auth/AuthTabCallback#onWarmupCompleted(android.os.Bundle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html extras)` Called when the browser process finished warming up initiated by warmup. |

## Public methods

### onExtraCallback

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
abstract void onExtraCallback(@NonNull String callbackName, @NonNull Bundle args)
```

Unsupported callbacks that may be provided by the implementation.

**Note:** Clients should **never** rely on this callback to be called and/or to have a defined behavior, as it is entirely implementation-defined and not supported.

This can be used by implementations to add extra callbacks, for testing or experimental purposes.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html callbackName` | Name of the extra callback. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html args` | Arguments for the callback |

### onExtraCallbackWithResult

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
abstract @NonNull Bundle onExtraCallbackWithResult(
    @NonNull String callbackName,
    @NonNull Bundle args
)
```

The same as `https://developer.android.com/reference/androidx/browser/auth/AuthTabCallback#onExtraCallback(java.lang.String,android.os.Bundle)`, except that this method allows the Auth Tab provider to return a result. A return value of `https://developer.android.com/reference/android/os/Bundle.html#EMPTY` will be used to signify that the client does not know how to handle the callback. As optional best practices, `https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsService#KEY_SUCCESS()` could be use to identify that callback was \*successfully\* handled. For example, when returning a message with result:

```
    Bundle result = new Bundle();
    result.putString("message", message);
    if (success)
        result.putBoolean(CustomTabsService#KEY_SUCCESS, true);
    return result;
```
The caller side:

```
    Bundle result = extraCallbackWithResult(callbackName, args);
    if (result.getBoolean(CustomTabsService#KEY_SUCCESS)) {
        // callback was successfully handled
    }
```

### onNavigationEvent

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
abstract void onNavigationEvent(int navigationEvent, @NonNull Bundle extras)
```

To be called when a navigation event happens.

| Parameters |
|---|---|
| `int navigationEvent` | The code corresponding to the navigation event. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html extras` | Reserved for future use. |

### onWarmupCompleted

Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/browser#1.9.0)

```
abstract void onWarmupCompleted(@NonNull Bundle extras)
```

Called when the browser process finished warming up initiated by warmup.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html extras` | Reserved for future use. |