# ProfileVerifier

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

*** ** * ** ***

<br />

```
class ProfileVerifier
```

<br />

*** ** * ** ***

Provides API to verify whether a compilation profile was installed with the app. This does not make a distinction between cloud or baseline profile. The output of `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier#getCompilationStatusAsync()` allows to check if the app has been compiled with a compiled profile or whether there is a profile enqueued for compilation. If `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileInstallerInitializer` was disabled, it's necessary to manually trigger the method `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier#writeProfileVerification(android.content.Context)` or the `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` returned by `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier#getCompilationStatusAsync()` will hang or timeout. Note that `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier` requires `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#P` due to a permission issue: the reference profile folder is not accessible to pre api 28. When calling this api on unsupported api, `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier#getCompilationStatusAsync()` returns `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier.CompilationStatus#RESULT_CODE_ERROR_UNSUPPORTED_API_VERSION()`. The same permission issue exists also on `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#R` so also in that case the api returns `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier.CompilationStatus#RESULT_CODE_ERROR_UNSUPPORTED_API_VERSION()`.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier.CompilationStatus` `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier.CompilationStatus` contains the result of a profile verification operation. |

| ### Public functions |
|---|---|
| `java-static https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier.CompilationStatus!>` | `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier#getCompilationStatusAsync()()` Returns a future containing the `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier.CompilationStatus` of the app profile. |
| `java-static https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier.CompilationStatus` | `@https://developer.android.com/reference/kotlin/androidx/annotation/WorkerThread https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier#writeProfileVerification(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html)` Caches the information on whether a reference profile exists for this app. |

## Public functions

### getCompilationStatusAsync

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

```
java-static fun getCompilationStatusAsync(): ListenableFuture<ProfileVerifier.CompilationStatus!>
```

Returns a future containing the `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier.CompilationStatus` of the app profile. The `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier.CompilationStatus` can be used to determine whether a baseline or cloud profile is installed either through app store or package manager (reference profile) or profile installer (current profile), in order to tag performance metrics versions. In the first case a reference profile is immediately installed, i.e. a the app has been compiled with a profile. In the second case the profile is awaiting compilation that will happen at some point later in background.

| Returns |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier.CompilationStatus!>` | A future containing the `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier.CompilationStatus`. |

### writeProfileVerification

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

```
@WorkerThread
java-static fun writeProfileVerification(context: Context): ProfileVerifier.CompilationStatus
```

Caches the information on whether a reference profile exists for this app. This method performs IO operations and should not be executed on main thread. Note that this method should be called manually a few seconds after app startup if `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileInstallerInitializer` has been disabled.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | an instance of the `https://developer.android.com/reference/android/content/Context.html`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier.CompilationStatus` | the `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier.CompilationStatus` of the app profile. Note that this is the same `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier.CompilationStatus` obtained through `https://developer.android.com/reference/kotlin/androidx/profileinstaller/ProfileVerifier#getCompilationStatusAsync()`. |