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.ConnectivityManager.NetworkCallback
Modifier and Type | Field and Description |
---|---|
static String |
PROPERTY_HOST
Property used to define the host.
|
static String |
PROPERTY_PAYLOAD
Property used to define the payload.
|
static 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(Timer timer)
Instantiates an
HttpPollerConnectivityManager with System properties values. |
HttpPollerConnectivityManager(Timer timer,
long delay,
long periodWhenAvaialble,
long periodWhenLost,
long periodWhenInternet)
Instantiates an
HttpPollerConnectivityManager with arguments values. |
Modifier and Type | Method and Description |
---|---|
protected NetworkCapabilities |
getCapabilities(InetAddress connectedAddress)
Gets the capabilities of a network.
|
void |
setHttpValues(String host,
String payload,
int port)
Sets the http values.
|
cancel, getNetworkInterface, getNetworkInterfaces, log, log, startPolling, stopPolling
doNotifyAvailabilityChange, doNotifyCapabilitiesChange, getActiveNetwork, getActiveNetworkInfo, getAllNetworks, getNetworkCapabilities, getNetworkInfo, notifyNetworkCallbacks, notifyNetworkCallbacks, registerDefaultNetworkCallback, registerNetworkCallback, setActiveNetwork, setAvailable, unregisterNetworkCallback
public static final String PROPERTY_HOST
public static final String PROPERTY_PAYLOAD
public static final String PROPERTY_PORT
public HttpPollerConnectivityManager()
HttpPollerConnectivityManager
with System properties values.
It uses the system properties:
PollerConnectivityManager()
public HttpPollerConnectivityManager(Timer timer)
HttpPollerConnectivityManager
with System properties values.
It uses the system properties:
timer
- the timer to use, cannot be null
.PollerConnectivityManager()
public HttpPollerConnectivityManager(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.protected NetworkCapabilities getCapabilities(InetAddress connectedAddress)
PollerConnectivityManager
getCapabilities
in class PollerConnectivityManager
connectedAddress
- the address to get the capabilities from, cannot be null
.