public class PMNetworkMonitor
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
PMNetworkMonitor.ConnectionType
Enum constant to maintain connection Type
Required for OpenWrap RTB 2.5
|
static interface |
PMNetworkMonitor.PMConnectivityListener
Interface definition to provide connectivity callbacks
|
static class |
PMNetworkMonitor.POBNetworkUpdateReceiver
Class definition to receive CONNECTIVITY_ACTION related updates
|
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<PMNetworkMonitor.PMConnectivityListener> |
connectivityListeners |
| Constructor and Description |
|---|
PMNetworkMonitor(android.content.Context context)
Construct PMNetworkMonitor
Please use
method instead of creating new instance.
|
| Modifier and Type | Method and Description |
|---|---|
PMNetworkMonitor.ConnectionType |
getConnectionType() |
boolean |
isNetworkAvailable()
Method is used to check if network is available
|
static boolean |
isNetworkAvailable(android.content.Context appContext)
Method is used to check if network is available
|
boolean |
isWiFiConnected() |
void |
registerConnectivityListener(PMNetworkMonitor.PMConnectivityListener connectivityListener)
Method is used to register the PMConnectivityListener to connectivityListeners`
|
void |
resetConnectivityListener()
Method is used to reset connectivity listener
|
void |
unregisterConnectivityListener(PMNetworkMonitor.PMConnectivityListener connectivityListener)
Method is used to unregister specific PMConnectivityListener which already registered
|
void |
updateConnectionType()
Updates connection type using connectivity manager, This method has to be called from constructor
and from broadcast receivers onReceive() method for action connectivity change.
|
@Nullable protected java.util.List<PMNetworkMonitor.PMConnectivityListener> connectivityListeners
public PMNetworkMonitor(@NonNull
android.content.Context context)
context - application contextpublic boolean isWiFiConnected()
@NonNull public PMNetworkMonitor.ConnectionType getConnectionType()
public boolean isNetworkAvailable()
public static boolean isNetworkAvailable(android.content.Context appContext)
appContext - of android application contextpublic void updateConnectionType()
@MainThread public void resetConnectivityListener()
@MainThread public void unregisterConnectivityListener(PMNetworkMonitor.PMConnectivityListener connectivityListener)
connectivityListener - of type PMConnectivityListener@MainThread public void registerConnectivityListener(PMNetworkMonitor.PMConnectivityListener connectivityListener)
connectivityListener - of type PMConnectivityListener