public class NetworkMonitor
extends java.lang.Object
Triggers updates to the underlying network state from OS networking events.
This class is thread-safe.
Modifier and Type | Class and Description |
---|---|
static interface |
NetworkMonitor.NetworkObserver
Alerted when the connection type of the network changes.
|
Modifier and Type | Method and Description |
---|---|
static void |
addNetworkObserver(NetworkMonitor.NetworkObserver observer)
Deprecated.
Use getInstance(appContext).addObserver instead.
|
void |
addObserver(NetworkMonitor.NetworkObserver observer) |
static NetworkMonitor |
getInstance()
Returns the singleton instance.
|
static void |
init(android.content.Context context)
Deprecated.
|
static boolean |
isOnline()
Checks if there currently is connectivity.
|
static void |
removeNetworkObserver(NetworkMonitor.NetworkObserver observer)
Deprecated.
Use getInstance(appContext).removeObserver instead.
|
void |
removeObserver(NetworkMonitor.NetworkObserver observer) |
void |
startMonitoring()
Deprecated.
|
void |
startMonitoring(android.content.Context applicationContext)
Enables auto detection of the network state change and brings up mobile networks for using
multi-networking.
|
void |
stopMonitoring()
Stop network monitoring.
|
@Deprecated public static void init(android.content.Context context)
public static NetworkMonitor getInstance()
public void startMonitoring(android.content.Context applicationContext)
@Deprecated public void startMonitoring()
public void stopMonitoring()
@Deprecated public static void addNetworkObserver(NetworkMonitor.NetworkObserver observer)
public void addObserver(NetworkMonitor.NetworkObserver observer)
@Deprecated public static void removeNetworkObserver(NetworkMonitor.NetworkObserver observer)
public void removeObserver(NetworkMonitor.NetworkObserver observer)
public static boolean isOnline()
6.0.0