public class ReactiveNetwork
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LOG_TAG |
Modifier | Constructor and Description |
---|---|
protected |
ReactiveNetwork() |
Modifier and Type | Method and Description |
---|---|
static <any> |
checkInternetConnectivity()
Checks connectivity with the Internet.
|
static <any> |
checkInternetConnectivity(InternetObservingSettings settings)
Checks connectivity with the Internet.
|
protected static <any> |
checkInternetConnectivity(InternetObservingStrategy strategy,
java.lang.String host,
int port,
int timeoutInMs,
int httpResponse,
ErrorHandler errorHandler)
Checks connectivity with the Internet.
|
static ReactiveNetwork |
create()
Creates a new instance of the ReactiveNetwork class
|
static <any> |
observeInternetConnectivity()
Observes connectivity with the Internet with default settings.
|
static <any> |
observeInternetConnectivity(InternetObservingSettings settings)
Observes connectivity with the Internet in a given time interval.
|
protected static <any> |
observeInternetConnectivity(InternetObservingStrategy strategy,
int initialIntervalInMs,
int intervalInMs,
java.lang.String host,
int port,
int timeoutInMs,
int httpResponse,
ErrorHandler errorHandler)
Observes connectivity with the Internet in a given time interval.
|
static <any> |
observeNetworkConnectivity(android.content.Context context)
Observes network connectivity.
|
static <any> |
observeNetworkConnectivity(android.content.Context context,
NetworkObservingStrategy strategy)
Observes network connectivity.
|
public static final java.lang.String LOG_TAG
public static ReactiveNetwork create()
public static <any> observeNetworkConnectivity(android.content.Context context)
context
- Context of the activity or an applicationpublic static <any> observeNetworkConnectivity(android.content.Context context, NetworkObservingStrategy strategy)
context
- Context of the activity or an applicationstrategy
- NetworkObserving strategy to be applied - you can use one of the existing
strategies PreLollipopNetworkObservingStrategy
,
LollipopNetworkObservingStrategy
or create your own custom strategypublic static <any> observeInternetConnectivity()
observeNetworkConnectivity(Context)
method and consumes data
transfer, but it gives you actual information if device is connected to the Internet or not.public static <any> observeInternetConnectivity(InternetObservingSettings settings)
settings
- Internet Observing Settings created via Builder patternprotected static <any> observeInternetConnectivity(InternetObservingStrategy strategy, int initialIntervalInMs, int intervalInMs, java.lang.String host, int port, int timeoutInMs, int httpResponse, ErrorHandler errorHandler)
strategy
- for observing Internet connectivityinitialIntervalInMs
- in milliseconds determining the delay of the first connectivity
checkintervalInMs
- in milliseconds determining how often we want to check connectivityhost
- for checking Internet connectivityport
- for checking Internet connectivitytimeoutInMs
- for pinging remote host in millisecondshttpResponse
- expected HTTP response code indicating that connection is establishederrorHandler
- for handling errors during connectivity checkpublic static <any> checkInternetConnectivity()
public static <any> checkInternetConnectivity(InternetObservingSettings settings)
settings
- Internet Observing Settings created via Builder patternprotected static <any> checkInternetConnectivity(InternetObservingStrategy strategy, java.lang.String host, int port, int timeoutInMs, int httpResponse, ErrorHandler errorHandler)
strategy
- for observing Internet connectivityhost
- for checking Internet connectivityport
- for checking Internet connectivitytimeoutInMs
- for pinging remote host in millisecondshttpResponse
- expected HTTP response code indicating that connection is establishederrorHandler
- for handling errors during connectivity check