public class HttpPollerConnectivityManager extends PollerConnectivityManager
NetworkInterface
which address is not 0.0.0.0
. It uses an HTTP request to check if it is connected to internet.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROPERTY_HOST
Property used to define the host.
|
static java.lang.String |
PROPERTY_PAYLOAD
Property used to define the payload.
|
static java.lang.String |
PROPERTY_PORT
Property used to define the port.
|
BASE_PROPERTY, INTERNET_CONNECTED, INTERNET_UNCONNECTED
Constructor and Description |
---|
HttpPollerConnectivityManager()
Instantiates an
HttpPollerConnectivityManager with System properties values. |
HttpPollerConnectivityManager(ej.bon.Timer timer)
Instantiates an
HttpPollerConnectivityManager with System properties values. |
HttpPollerConnectivityManager(ej.bon.Timer timer,
long delay,
long periodWhenAvaialble,
long periodWhenLost,
long periodWhenInternet)
Instantiates an
HttpPollerConnectivityManager with arguments values. |
Modifier and Type | Method and Description |
---|---|
protected android.net.NetworkCapabilities |
getCapabilities(java.net.InetAddress connectedAddress)
Gets the capabilities of a network.
|
void |
setHttpValues(java.lang.String host,
java.lang.String payload,
int port)
Sets the http values.
|
cancel, getNetworkInterface, getNetworkInterfaces, log, log, startPolling, stopPolling
doNotifyAvailabilityChange, doNotifyCapabilitiesChange, getActiveNetwork, getActiveNetworkInfo, getAllNetworks, getNetworkCapabilities, getNetworkInfo, notifyNetworkCallbacks, notifyNetworkCallbacks, notifyNetworkCallbacks, registerDefaultNetworkCallback, registerNetworkCallback, setActiveNetwork, setAvailable, unregisterNetworkCallback
public static final java.lang.String PROPERTY_PORT
public static final java.lang.String PROPERTY_HOST
public static final java.lang.String PROPERTY_PAYLOAD
public HttpPollerConnectivityManager()
HttpPollerConnectivityManager
with System properties values.
It uses the system properties:
public HttpPollerConnectivityManager(ej.bon.Timer timer)
HttpPollerConnectivityManager
with System properties values.
It uses the system properties:
timer
- the timer to use, cannot be null
.PollerConnectivityManager.PollerConnectivityManager()
public HttpPollerConnectivityManager(ej.bon.Timer timer, long delay, long periodWhenAvaialble, long periodWhenLost, long periodWhenInternet)
HttpPollerConnectivityManager
with arguments values.timer
- the timer to use, cannot be null
.delay
- the delay before the start.periodWhenAvaialble
- the period for the polling when at least one interface is available.periodWhenLost
- the period for the polling when all the interface are down.periodWhenInternet
- the period for the polling when there is internet access.public void setHttpValues(@Nullable java.lang.String host, @Nullable java.lang.String payload, int port)
host
- the host to use, cannot be null
.payload
- the payload to send, if null
a simple get request at the root will be used.port
- the port to use.protected android.net.NetworkCapabilities getCapabilities(java.net.InetAddress connectedAddress)
PollerConnectivityManager
getCapabilities
in class PollerConnectivityManager
connectedAddress
- the address to get the capabilities from, cannot be null
.