# 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
public interface ProfileStore
```

<br />

*** ** * ** ***

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

Example usage:

```
   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 methods |
|---|---|
| `abstract boolean` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/androidx/webkit/WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/androidx/webkit/ProfileStore#deleteProfile(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html name)` Deletes the profile data associated with the name. |
| `abstract @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html>` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/androidx/webkit/WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/androidx/webkit/ProfileStore#getAllProfileNames()()` Returns the names of all available profiles. |
| `default static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/webkit/ProfileStore` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/androidx/webkit/WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/androidx/webkit/ProfileStore#getInstance()()` Returns the production instance of ProfileStore. |
| `abstract @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/webkit/Profile` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/androidx/webkit/WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/androidx/webkit/ProfileStore#getOrCreateProfile(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html name)` Returns a profile with the given name, creating if needed. |
| `abstract @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/webkit/Profile` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(name = https://developer.android.com/reference/androidx/webkit/WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") https://developer.android.com/reference/androidx/webkit/ProfileStore#getProfile(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html name)` Returns a profile with the given name, if it exists. |

## Public methods

### 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")
abstract boolean deleteProfile(@NonNull String name)
```

Deletes the profile data associated with the name.

If this method returns true, the `https://developer.android.com/reference/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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html name` | the profile name to be deleted. |

| Returns |
|---|---|
| `boolean` | `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/androidx/webkit/ProfileStore#getOrCreateProfile(java.lang.String)`} or `https://developer.android.com/reference/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/androidx/webkit/WebViewFeature#MULTI_PROFILE()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
abstract @NonNull List<String> getAllProfileNames()
```

Returns the names of all available profiles.

Default profile name will be included in this list.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html>` | profile names as a list. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/androidx/webkit/WebViewFeature#MULTI_PROFILE()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
default static @NonNull ProfileStore getInstance()
```

Returns the production instance of ProfileStore.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/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/androidx/webkit/WebViewFeature#MULTI_PROFILE()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
abstract @NonNull Profile getOrCreateProfile(@NonNull String name)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html name` | name of the profile to retrieve. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/webkit/Profile` | instance of `https://developer.android.com/reference/androidx/webkit/Profile` matching this name. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if the `https://developer.android.com/reference/androidx/webkit/WebViewFeature#MULTI_PROFILE()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/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")
abstract @Nullable Profile getProfile(@NonNull String name)
```

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/androidx/webkit/ProfileStore#deleteProfile(java.lang.String)` it will return null.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html name` | the name of the profile to retrieve. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/webkit/Profile` | instance of `https://developer.android.com/reference/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/androidx/webkit/WebViewFeature#MULTI_PROFILE()` feature is not supported. This should be checked before use with `https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)`. |