UserAgentMetadata


public final class UserAgentMetadata


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

This class is functionally equivalent to UADataValues.

Summary

Nested types

Class that holds brand name, major version and full version.

Builder used to create BrandVersion objects.

public final class UserAgentMetadata.Builder

Builder used to create UserAgentMetadata objects.

Constants

static final int

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

Public methods

boolean

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

@Nullable String

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

int

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

@NonNull List<UserAgentMetadata.BrandVersion>

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.

@Nullable String

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

@Nullable String

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

@Nullable String

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

@Nullable String

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

int
boolean

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

boolean

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

Constants

BITNESS_DEFAULT

Added in 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.

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
public @Nullable String getArchitecture()

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

See also
setArchitecture

getBitness

Added in 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 BITNESS_DEFAULT means an empty string.

See also
setBitness

getBrandVersionList

Added in 1.9.0
public @NonNull List<UserAgentMetadata.BrandVersiongetBrandVersionList()

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 BrandVersion object holds the brand name, brand major version and brand full version.

getFullVersion

Added in 1.9.0
public @Nullable String getFullVersion()

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

See also
setFullVersion

getModel

Added in 1.9.0
public @Nullable String getModel()

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

See also
setModel

getPlatform

Added in 1.9.0
public @Nullable String getPlatform()

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

See also
setPlatform

getPlatformVersion

Added in 1.9.0
public @Nullable String getPlatformVersion()

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

Returns
@Nullable String

Platform version string.

hashCode

public int hashCode()

isMobile

Added in 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
setMobile

isWow64

Added in 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
setWow64