JavaCronetProvider

public class JavaCronetProvider extends CronetProvider


Implementation of CronetProvider that creates CronetEngine.Builder for building the Java-based implementation of CronetEngine.

Summary

Constants

static final String
FORCE_HTTPENGINE_FLAG = "Cronet_ForceHttpEngineInFallback"

Public constructors

Constructor.

Public methods

CronetEngine.Builder

Creates and returns an instance of CronetEngine.Builder.

boolean
equals(Object other)
String

Returns the provider name.

String

Returns the provider version.

int
boolean

Returns whether the provider is enabled and can be used to instantiate the Cronet engine.

Inherited Constants

From org.chromium.net.CronetProvider
static final String
PROVIDER_NAME_APP_PACKAGED = "App-Packaged-Cronet-Provider"

String returned by getName for CronetProvider that provides native Cronet implementation packaged inside an application.

static final String
PROVIDER_NAME_FALLBACK = "Fallback-Cronet-Provider"

String returned by getName for CronetProvider that provides Cronet implementation based on the system's java.net.HttpURLConnection implementation.

static final String
PROVIDER_NAME_HTTPENGINE_NATIVE = "HttpEngine-Native-Provider"

String returned by getName for CronetProvider that provides Cronet implementation based on the HttpEngine implementation present in the Platform.

Inherited fields

From org.chromium.net.CronetProvider

Inherited methods

From org.chromium.net.CronetProvider
static List<CronetProvider>

Returns an unmodifiable list of all available CronetProviders.

String

Constants

FORCE_HTTPENGINE_FLAG

public static final String FORCE_HTTPENGINE_FLAG = "Cronet_ForceHttpEngineInFallback"

Public constructors

JavaCronetProvider

public JavaCronetProvider(Context context)

Constructor.

Parameters
Context context

Android context to use.

Public methods

createBuilder

public CronetEngine.Builder createBuilder()

Creates and returns an instance of CronetEngine.Builder.

NOTE: This class is for advanced users that want to select a particular Cronet implementation. Most users should simply use newCronetEngine.Builder.
Returns
CronetEngine.Builder

CronetEngine.Builder.

Throws
java.lang.IllegalStateException

if the provider is not enabled (see isEnabled.

equals

public boolean equals(Object other)

getName

public String getName()

Returns the provider name. The well-know provider names include:

Returns
String

provider name.

getVersion

public String getVersion()

Returns the provider version. The version can be used to select the newest available provider if multiple providers are available.

Returns
String

provider version.

hashCode

public int hashCode()

isEnabled

public boolean isEnabled()

Returns whether the provider is enabled and can be used to instantiate the Cronet engine. A provider being out-of-date (older than the API) and needing updating is one potential reason it could be disabled. Please read the provider documentation for enablement procedure.

Returns
boolean

true if the provider is enabled.