# ProfileStore

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

*** ** * ** ***


```
@UiThread
interface ProfileStore
```

<br />

*** ** * ** ***

Manages any creation, deletion for `https://developer.android.com/reference/kotlin/androidx/webkit/Profile`.

Example usage:

```kotlin
   ProfileStore profileStore = ProfileStore.getInstance();

      
   // Use this store instance to manage Profiles.
   Profile createdProfile = profileStore.getOrCreateProfile("test_profile");
   createdProfile.getGeolocationPermissions().clear("example");
   //...
   profileStore.deleteProfile("profile_test");

    
```

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/ProfileStore#deleteProfile(java.lang.String)(name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Deletes the profile data associated with the name. |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/ProfileStore#getAllProfileNames()()` Returns the names of all available profiles. |
| `java-static https://developer.android.com/reference/kotlin/androidx/webkit/ProfileStore` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/ProfileStore#getInstance()()` Returns the production instance of ProfileStore. |
| `https://developer.android.com/reference/kotlin/androidx/webkit/Profile` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/ProfileStore#getOrCreateProfile(java.lang.String)(name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Returns a profile with the given name, creating if needed. |
| `https://developer.android.com/reference/kotlin/androidx/webkit/Profile?` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/kotlin/androidx/webkit/ProfileStore#getProfile(java.lang.String)(name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Returns a profile with the given name, if it exists. |

## Public functions

### deleteProfile

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

```
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
fun deleteProfile(name: String): Boolean
```

Deletes the profile data associated with the name.

If this method returns true, the `https://developer.android.com/reference/kotlin/androidx/webkit/Profile` object associated with the name will no longer be usable by the application. Returning false means that this profile doesn't exist.

Some data may be deleted async and is not guaranteed to be cleared from disk by the time this method returns.

| Parameters |
|---|---|
| `name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the profile name to be deleted. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if profile exists and its data is to be deleted, otherwise ` false`. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if there are living WebViews associated with that profile. |
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if you are trying to delete a Profile that was loaded in the memory using `https://developer.android.com/reference/kotlin/androidx/webkit/ProfileStore#getOrCreateProfile(java.lang.String)`} or `https://developer.android.com/reference/kotlin/androidx/webkit/ProfileStore#getProfile(java.lang.String)`. |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if you are trying to delete the default Profile. |
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#MULTI_PROFILE()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`. |

### getAllProfileNames

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

```
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
fun getAllProfileNames(): (Mutable)List<String!>
```

Returns the names of all available profiles.

Default profile name will be included in this list.

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | profile names as a list. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#MULTI_PROFILE()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`. |

### getInstance

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

```
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
java-static fun getInstance(): ProfileStore
```

Returns the production instance of ProfileStore.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/ProfileStore` | ProfileStore instance to use for managing profiles. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#MULTI_PROFILE()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`. |

### getOrCreateProfile

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

```
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
fun getOrCreateProfile(name: String): Profile
```

Returns a profile with the given name, creating if needed.

Returns the associated Profile with this name, if there's no match with this name it will create a new Profile instance.

| Parameters |
|---|---|
| `name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | name of the profile to retrieve. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/Profile` | instance of `https://developer.android.com/reference/kotlin/androidx/webkit/Profile` matching this name. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#MULTI_PROFILE()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`. |

### getProfile

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

```
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
fun getProfile(name: String): Profile?
```

Returns a profile with the given name, if it exists.

Returns the associated Profile with this name, if there's no Profile with this name or the Profile was deleted by `https://developer.android.com/reference/kotlin/androidx/webkit/ProfileStore#deleteProfile(java.lang.String)` it will return null.

| Parameters |
|---|---|
| `name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the name of the profile to retrieve. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/Profile?` | instance of `https://developer.android.com/reference/kotlin/androidx/webkit/Profile` matching this name, null otherwise if there's no match. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#MULTI_PROFILE()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`. |