CronetRequestCompletionListener

public interface CronetRequestCompletionListener<T>


A completion listener for accepting the results of a Cronet request asynchronously.

To attach to a Cronet request use InMemoryTransformCronetCallback and call addCompletionListener.

Parameters
<T>

the response body type

Summary

Public methods

abstract void

Invoked if request was canceled via UrlRequest#cancel.

abstract void

Invoked if request failed for any reason after starting the request.

abstract void
onSucceeded(UrlResponseInfo info, T body)

Invoked when request is completed successfully.

Public methods

onCanceled

abstract void onCanceled(@Nullable UrlResponseInfo info)

Invoked if request was canceled via UrlRequest#cancel. Once invoked, no other methods will be invoked on this object.

Parameters
@Nullable UrlResponseInfo info

Response information. May be null if no response was received.

onFailed

abstract void onFailed(@Nullable UrlResponseInfo info, CronetException exception)

Invoked if request failed for any reason after starting the request. Once invoked, no other methods will be invoked on this object. exception provides information about the failure.

Parameters
@Nullable UrlResponseInfo info

Response information. May be null if no response was received.

CronetException exception

detailed information about the error that occurred.

onSucceeded

abstract void onSucceeded(UrlResponseInfo info, T body)

Invoked when request is completed successfully. Once invoked, no other methods will be invoked on this object.

Parameters
UrlResponseInfo info

Response information.

T body

The response body transformed to the desired type.