public final class NetworkingModule extends ReactContextBaseJavaModule
NativeModule.NativeMethod
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
NAME |
METHOD_TYPE_ASYNC, METHOD_TYPE_PROMISE, METHOD_TYPE_SYNC
Constructor and Description |
---|
NetworkingModule(ReactApplicationContext context) |
NetworkingModule(ReactApplicationContext context,
java.util.List<NetworkInterceptorCreator> networkInterceptorCreators) |
NetworkingModule(ReactApplicationContext context,
java.lang.String defaultUserAgent) |
Modifier and Type | Method and Description |
---|---|
void |
abortRequest(int requestId) |
void |
clearCookies(Callback callback) |
java.lang.String |
getName() |
void |
initialize()
This is called at the end of
CatalystApplicationFragment#createCatalystInstance()
after the CatalystInstance has been created, in order to initialize NativeModules that require
the CatalystInstance or JS modules. |
void |
onCatalystInstanceDestroy()
Called before {CatalystInstance#onHostDestroy}
|
void |
sendRequest(java.lang.String method,
java.lang.String url,
int requestId,
ReadableArray headers,
ReadableMap data,
java.lang.String responseType,
boolean useIncrementalUpdates,
int timeout,
boolean withCredentials) |
getCurrentActivity, getReactApplicationContext
canOverrideExistingModule, getConstants, hasConstants
protected static final java.lang.String NAME
public NetworkingModule(ReactApplicationContext context)
context
- the ReactContext of the applicationpublic NetworkingModule(ReactApplicationContext context, java.util.List<NetworkInterceptorCreator> networkInterceptorCreators)
context
- the ReactContext of the applicationnetworkInterceptorCreators
- list of NetworkInterceptorCreator
's whose create()
methods would be called to attach the interceptors to the client.public NetworkingModule(ReactApplicationContext context, java.lang.String defaultUserAgent)
context
- the ReactContext of the applicationdefaultUserAgent
- the User-Agent header that will be set for all requests where the
caller does not provide one explicitlypublic void initialize()
NativeModule
CatalystApplicationFragment#createCatalystInstance()
after the CatalystInstance has been created, in order to initialize NativeModules that require
the CatalystInstance or JS modules.initialize
in interface NativeModule
initialize
in class BaseJavaModule
public java.lang.String getName()
require()
this module
from javascript.public void onCatalystInstanceDestroy()
NativeModule
onCatalystInstanceDestroy
in interface NativeModule
onCatalystInstanceDestroy
in class BaseJavaModule
public void sendRequest(java.lang.String method, java.lang.String url, int requestId, ReadableArray headers, ReadableMap data, java.lang.String responseType, boolean useIncrementalUpdates, int timeout, boolean withCredentials)
public void abortRequest(int requestId)
public void clearCookies(Callback callback)