# PrepareGetCredentialResponse

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

*** ** * ** ***

<br />

```
@RequiresApi(value = 34)
class PrepareGetCredentialResponse
```

<br />

*** ** * ** ***

A response object that indicates the get-credential prefetch work is complete and provides metadata about it. It can then be used to issue the full credential retrieval flow via the `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialManager#getCredential(android.content.Context,androidx.credentials.GetCredentialRequest)` (Kotlin) / `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialManager#getCredentialAsync(android.content.Context,androidx.credentials.GetCredentialRequest,android.os.CancellationSignal,java.util.concurrent.Executor,androidx.credentials.CredentialManagerCallback)` (Java) method to perform the remaining flows such as consent collection and credential selection, to officially retrieve a credential.

For now this API requires Android U (level 34). However, it is designed with backward compatibility in mind and can potentially be made accessible \<34 if any provider decides to support that.

This class should be constructed using the Builder (see below) for tests/prod usage.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-null-pointer-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/PrepareGetCredentialResponse#pendingGetCredentialHandle()` is null at API level \>= 34. |

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 34) class https://developer.android.com/reference/kotlin/androidx/credentials/PrepareGetCredentialResponse.PendingGetCredentialHandle` A handle that represents a pending get-credential operation. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/VisibleForTesting class https://developer.android.com/reference/kotlin/androidx/credentials/PrepareGetCredentialResponse.TestBuilder` A builder for `https://developer.android.com/reference/android/credentials/PrepareGetCredentialResponse.html` for test use only. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission(value = "android.permission.CREDENTIAL_MANAGER_QUERY_CANDIDATE_CREDENTIALS") https://developer.android.com/reference/kotlin/androidx/credentials/PrepareGetCredentialResponse#hasAuthenticationResults()()` Returns true if the user has any candidate authentication actions (locked credential supplier), and false otherwise. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission(value = "android.permission.CREDENTIAL_MANAGER_QUERY_CANDIDATE_CREDENTIALS") https://developer.android.com/reference/kotlin/androidx/credentials/PrepareGetCredentialResponse#hasCredentialResults(kotlin.String)(credentialType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Returns true if the user has any candidate credentials for the given {@code credentialType}, and false otherwise. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission(value = "android.permission.CREDENTIAL_MANAGER_QUERY_CANDIDATE_CREDENTIALS") https://developer.android.com/reference/kotlin/androidx/credentials/PrepareGetCredentialResponse#hasRemoteResults()()` Returns true if the user has any candidate remote credential results, and false otherwise. |

| ### Public properties |
|---|---|
| `((https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)?` | `https://developer.android.com/reference/kotlin/androidx/credentials/PrepareGetCredentialResponse#credentialTypeDelegate()` whether the response has a credential result handler |
| `(() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)?` | `https://developer.android.com/reference/kotlin/androidx/credentials/PrepareGetCredentialResponse#hasAuthResultsDelegate()` whether the response has auth results |
| `(() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)?` | `https://developer.android.com/reference/kotlin/androidx/credentials/PrepareGetCredentialResponse#hasRemoteResultsDelegate()` whether the response has remote results |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/credentials/PrepareGetCredentialResponse#isNullHandlesForTest()` whether to support null handles for test |
| `https://developer.android.com/reference/kotlin/androidx/credentials/PrepareGetCredentialResponse.PendingGetCredentialHandle?` | `https://developer.android.com/reference/kotlin/androidx/credentials/PrepareGetCredentialResponse#pendingGetCredentialHandle()` a handle that represents this pending get-credential operation; pass this handle to `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialManager#getCredential(android.content.Context,androidx.credentials.GetCredentialRequest)` (Kotlin) / `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialManager#getCredentialAsync(android.content.Context,androidx.credentials.GetCredentialRequest,android.os.CancellationSignal,java.util.concurrent.Executor,androidx.credentials.CredentialManagerCallback)` (Java) to perform the remaining flows to officially retrieve a credential. |

## Public functions

### hasAuthenticationResults

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

```
@RequiresPermission(value = "android.permission.CREDENTIAL_MANAGER_QUERY_CANDIDATE_CREDENTIALS")
fun hasAuthenticationResults(): Boolean
```

Returns true if the user has any candidate authentication actions (locked credential supplier), and false otherwise.

Note: this API will always return false at API level \< 34.

### hasCredentialResults

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

```
@RequiresPermission(value = "android.permission.CREDENTIAL_MANAGER_QUERY_CANDIDATE_CREDENTIALS")
fun hasCredentialResults(credentialType: String): Boolean
```

Returns true if the user has any candidate credentials for the given {@code credentialType}, and false otherwise.

Note: this API will always return false at API level \< 34.

### hasRemoteResults

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

```
@RequiresPermission(value = "android.permission.CREDENTIAL_MANAGER_QUERY_CANDIDATE_CREDENTIALS")
fun hasRemoteResults(): Boolean
```

Returns true if the user has any candidate remote credential results, and false otherwise.

Note: this API will always return false at API level \< 34.

## Public properties

### credentialTypeDelegate

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

```
val credentialTypeDelegate: ((String) -> Boolean)?
```

whether the response has a credential result handler

### hasAuthResultsDelegate

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

```
val hasAuthResultsDelegate: (() -> Boolean)?
```

whether the response has auth results

### hasRemoteResultsDelegate

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

```
val hasRemoteResultsDelegate: (() -> Boolean)?
```

whether the response has remote results

### isNullHandlesForTest

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

```
val isNullHandlesForTest: Boolean
```

whether to support null handles for test

### pendingGetCredentialHandle

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

```
val pendingGetCredentialHandle: PrepareGetCredentialResponse.PendingGetCredentialHandle?
```

a handle that represents this pending get-credential operation; pass this handle to `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialManager#getCredential(android.content.Context,androidx.credentials.GetCredentialRequest)` (Kotlin) / `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialManager#getCredentialAsync(android.content.Context,androidx.credentials.GetCredentialRequest,android.os.CancellationSignal,java.util.concurrent.Executor,androidx.credentials.CredentialManagerCallback)` (Java) to perform the remaining flows to officially retrieve a credential.