# CredentialEventsProvider

Artifact: [androidx.credentials.providerevents:providerevents](https://developer.android.com/jetpack/androidx/releases/credentials-providerevents) [View Source](https://cs.android.com/search?q=file:androidx/credentials/providerevents/CredentialEventsProvider.kt+class:androidx.credentials.providerevents.CredentialEventsProvider) Added in [1.0.0-beta01](https://developer.android.com/jetpack/androidx/releases/credentials-providerevents#1.0.0-beta01)

*** ** * ** ***


```
public interface CredentialEventsProvider
```

<br />

*** ** * ** ***

Defines an interface for system components that handle credential event propagation APIs.

System components implement this interface to return a stub `https://developer.android.com/reference/android/os/IBinder.html` to be used by `https://developer.android.com/reference/androidx/credentials/providerevents/service/CredentialProviderEventsService`.

**Usage:**

1. System components implement this interface.

2. When binding to `https://developer.android.com/reference/androidx/credentials/providerevents/service/CredentialProviderEventsService`, the service instantiates and returns the implemented class based on the `EVENTS_PROVIDER_KEY` extra in the intent.

3. The returned `https://developer.android.com/reference/android/os/IBinder.html` allows the feature provider to execute custom logic before calling the public endpoints of `https://developer.android.com/reference/androidx/credentials/providerevents/service/CredentialProviderEventsService`.

This mechanism enables system components to manage their own event propagation to credential providers.

## Summary

| ### Constants |
|---|---|
| `default static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/credentials/providerevents/CredentialEventsProvider#EVENTS_SERVICE_PROVIDER_KEY()` The key for the extra in the intent used to bind to the credential provider's service, specifying the class name that implements `https://developer.android.com/reference/androidx/credentials/providerevents/CredentialEventsProvider`. |

| ### Public methods |
|---|---|
| `abstract https://developer.android.com/reference/android/os/IBinder.html` | `https://developer.android.com/reference/androidx/credentials/providerevents/CredentialEventsProvider#getStubImplementation(androidx.credentials.providerevents.service.CredentialProviderEventsService)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/providerevents/service/CredentialProviderEventsService service)` Returns the `https://developer.android.com/reference/android/os/IBinder.html` stub implementation. |

## Constants

### EVENTS_SERVICE_PROVIDER_KEY

Added in [1.0.0-beta01](https://developer.android.com/jetpack/androidx/releases/credentials-providerevents#1.0.0-beta01)

```
default static final @NonNull String EVENTS_SERVICE_PROVIDER_KEY
```

The key for the extra in the intent used to bind to the credential provider's service, specifying the class name that implements `https://developer.android.com/reference/androidx/credentials/providerevents/CredentialEventsProvider`.

## Public methods

### getStubImplementation

Added in [1.0.0-beta01](https://developer.android.com/jetpack/androidx/releases/credentials-providerevents#1.0.0-beta01)

```
abstract IBinder getStubImplementation(@NonNull CredentialProviderEventsService service)
```

Returns the `https://developer.android.com/reference/android/os/IBinder.html` stub implementation.

This stub is invoked by the feature provider after binding to `https://developer.android.com/reference/androidx/credentials/providerevents/service/CredentialProviderEventsService`. It allows the feature provider to execute custom logic before interacting with the service.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/providerevents/service/CredentialProviderEventsService service` | The instance of `https://developer.android.com/reference/androidx/credentials/providerevents/service/CredentialProviderEventsService` to interact with. |