# UserAgentMetadata

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

*** ** * ** ***


```
public final class UserAgentMetadata
```

<br />

*** ** * ** ***

Holds user-agent metadata information and uses to generate user-agent client hints.

This class is functionally equivalent to [UADataValues](https://wicg.github.io/ua-client-hints/#interface).

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.BrandVersion` Class that holds brand name, major version and full version. |
| `public final class https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.BrandVersion.Builder` Builder used to create `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.BrandVersion` objects. |
| `public final class https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder` Builder used to create `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata` objects. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#BITNESS_DEFAULT() = 0` Use this value for bitness to use the platform's default bitness value, which is an empty string for Android WebView. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#FORM_FACTOR_AUTOMOTIVE() = "Automotive"` Form factor option: `Automotive`, to be used with `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setFormFactors(java.util.List<java.lang.String>)` and `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getFormFactors()`. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#FORM_FACTOR_DESKTOP() = "Desktop"` Form factor option: `Desktop`, to be used with `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setFormFactors(java.util.List<java.lang.String>)` and `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getFormFactors()`. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#FORM_FACTOR_EINK() = "EInk"` Form factor option: `EInk`, to be used with `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setFormFactors(java.util.List<java.lang.String>)` and `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getFormFactors()`. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#FORM_FACTOR_MOBILE() = "Mobile"` Form factor option: `Mobile`, to be used with `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setFormFactors(java.util.List<java.lang.String>)` and `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getFormFactors()`. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#FORM_FACTOR_TABLET() = "Tablet"` Form factor option: `Tablet`, to be used with `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setFormFactors(java.util.List<java.lang.String>)` and `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getFormFactors()`. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#FORM_FACTOR_WATCH() = "Watch"` Form factor option: `Watch`, to be used with `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setFormFactors(java.util.List<java.lang.String>)` and `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getFormFactors()`. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#FORM_FACTOR_XR() = "XR"` Form factor option: `XR`, to be used with `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setFormFactors(java.util.List<java.lang.String>)` and `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getFormFactors()`. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object.html o)` Two UserAgentMetadata objects are equal only if all the metadata values are equal. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getArchitecture()()` Returns the value for the `sec-ch-ua-arch` client hint. |
| `int` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getBitness()()` Returns the value for the `sec-ch-ua-bitness` client hint. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.BrandVersion>` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getBrandVersionList()()` Returns the current list of user-agent brand versions which are used to populate user-agent client hints `sec-ch-ua` and `sec-ch-ua-full-version-list`. |
| `@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/webkit/UserAgentMetadata#getFormFactors()()` Returns the value for the `sec-ch-ua-form-factors` client hint. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getFullVersion()()` Returns the value for the `sec-ch-ua-full-version` client hint. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getModel()()` Returns the value for the `sec-ch-ua-model` client hint. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getPlatform()()` Returns the value for the `sec-ch-ua-platform` client hint. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getPlatformVersion()()` Returns the value for the `sec-ch-ua-platform-version` client hint. |
| `int` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#hashCode()()` |
| `boolean` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#isMobile()()` Returns the value for the `sec-ch-ua-mobile` client hint. |
| `boolean` | `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#isWow64()()` Returns the value for the `sec-ch-ua-wow64` client hint. |

## Constants

### BITNESS_DEFAULT

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

```
public static final int BITNESS_DEFAULT = 0
```

Use this value for bitness to use the platform's default bitness value, which is an empty string for Android WebView.

### FORM_FACTOR_AUTOMOTIVE

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

```
public static final String FORM_FACTOR_AUTOMOTIVE = "Automotive"
```

Form factor option: `Automotive`, to be used with `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setFormFactors(java.util.List<java.lang.String>)` and `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getFormFactors()`.

### FORM_FACTOR_DESKTOP

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

```
public static final String FORM_FACTOR_DESKTOP = "Desktop"
```

Form factor option: `Desktop`, to be used with `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setFormFactors(java.util.List<java.lang.String>)` and `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getFormFactors()`.

### FORM_FACTOR_EINK

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

```
public static final String FORM_FACTOR_EINK = "EInk"
```

Form factor option: `EInk`, to be used with `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setFormFactors(java.util.List<java.lang.String>)` and `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getFormFactors()`.

### FORM_FACTOR_MOBILE

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

```
public static final String FORM_FACTOR_MOBILE = "Mobile"
```

Form factor option: `Mobile`, to be used with `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setFormFactors(java.util.List<java.lang.String>)` and `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getFormFactors()`.

### FORM_FACTOR_TABLET

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

```
public static final String FORM_FACTOR_TABLET = "Tablet"
```

Form factor option: `Tablet`, to be used with `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setFormFactors(java.util.List<java.lang.String>)` and `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getFormFactors()`.

### FORM_FACTOR_WATCH

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

```
public static final String FORM_FACTOR_WATCH = "Watch"
```

Form factor option: `Watch`, to be used with `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setFormFactors(java.util.List<java.lang.String>)` and `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getFormFactors()`.

### FORM_FACTOR_XR

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

```
public static final String FORM_FACTOR_XR = "XR"
```

Form factor option: `XR`, to be used with `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setFormFactors(java.util.List<java.lang.String>)` and `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#getFormFactors()`.

## Public methods

### equals

```
public boolean equals(Object o)
```

Two UserAgentMetadata objects are equal only if all the metadata values are equal.

### getArchitecture

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

```
public @Nullable String getArchitecture()
```

Returns the value for the `sec-ch-ua-arch` client hint.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setArchitecture(java.lang.String)` |   |

### getBitness

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

```
public int getBitness()
```

Returns the value for the `sec-ch-ua-bitness` client hint.

| Returns |
|---|---|
| `int` | An integer indicates the CPU bitness, the integer value will convert to string when generating the user-agent client hint, and `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#BITNESS_DEFAULT()` means an empty string. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setBitness(int)` |   |

### getBrandVersionList

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

```
public @NonNull List<UserAgentMetadata.BrandVersion> getBrandVersionList()
```

Returns the current list of user-agent brand versions which are used to populate user-agent client hints `sec-ch-ua` and `sec-ch-ua-full-version-list`. Each `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.BrandVersion` object holds the brand name, brand major version and brand full version.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setBrandVersionList(java.util.List<androidx.webkit.UserAgentMetadata.BrandVersion>)` |   |

### getFormFactors

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

```
public @NonNull List<String> getFormFactors()
```

Returns the value for the `sec-ch-ua-form-factors` client hint. Value should be one or more of `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#FORM_FACTOR_DESKTOP()`, `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#FORM_FACTOR_AUTOMOTIVE()`, `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#FORM_FACTOR_MOBILE()`, `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#FORM_FACTOR_TABLET()`, `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#FORM_FACTOR_XR()`, `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#FORM_FACTOR_EINK()`, `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata#FORM_FACTOR_WATCH()`. See the [spec](https://wicg.github.io/ua-client-hints/#sec-ch-ua-form-factors) for more details.

| 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>` | A list of strings to indicate the form factors of the user-agent. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setFormFactors(java.util.List<java.lang.String>)` |   |

### getFullVersion

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

```
public @Nullable String getFullVersion()
```

Returns the value for the `sec-ch-ua-full-version` client hint.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setFullVersion(java.lang.String)` |   |

### getModel

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

```
public @Nullable String getModel()
```

Returns the value for the `sec-ch-ua-model` client hint.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setModel(java.lang.String)` |   |

### getPlatform

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

```
public @Nullable String getPlatform()
```

Returns the value for the `sec-ch-ua-platform` client hint.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setPlatform(java.lang.String)` |   |

### getPlatformVersion

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

```
public @Nullable String getPlatformVersion()
```

Returns the value for the `sec-ch-ua-platform-version` client hint.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | Platform version string. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setPlatformVersion(java.lang.String)` |   |

### hashCode

```
public int hashCode()
```

### isMobile

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

```
public boolean isMobile()
```

Returns the value for the `sec-ch-ua-mobile` client hint.

| Returns |
|---|---|
| `boolean` | A boolean indicates user-agent's device mobileness. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setMobile(boolean)` |   |

### isWow64

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

```
public boolean isWow64()
```

Returns the value for the `sec-ch-ua-wow64` client hint.

| Returns |
|---|---|
| `boolean` | A boolean to indicate whether user-agent's binary is running in 32-bit mode on 64-bit Windows. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/webkit/UserAgentMetadata.Builder#setWow64(boolean)` |   |