Package com.telnyx.webrtc.lib
Class NetworkMonitor
java.lang.Object
com.telnyx.webrtc.lib.NetworkMonitor
Borrowed from Chromium's
src/net/android/java/src/org/chromium/net/NetworkChangeNotifier.java
Triggers updates to the underlying network state from OS networking events.
This class is thread-safe.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAlerted when the connection type of the network changes. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidDeprecated.Use getInstance(appContext).addObserver instead.voidaddObserver(NetworkMonitor.NetworkObserver observer) static NetworkMonitorReturns the singleton instance.intstatic voidDeprecated.static booleanisOnline()Checks if there currently is connectivity.static voidDeprecated.Use getInstance(appContext).removeObserver instead.voidremoveObserver(NetworkMonitor.NetworkObserver observer) voidSet the factory that will be used to create the network change detector.voidDeprecated.voidstartMonitoring(Context applicationContext) Deprecated.voidstartMonitoring(Context applicationContext, String fieldTrialsString) Enables auto detection of the network state change and brings up mobile networks for using multi-networking.voidStop network monitoring.
-
Method Details
-
setNetworkChangeDetectorFactory
Set the factory that will be used to create the network change detector. Needs to be called before the monitoring is starts. -
init
Deprecated. -
getInstance
Returns the singleton instance. This may be called from native or from Java code. -
startMonitoring
Enables auto detection of the network state change and brings up mobile networks for using multi-networking. This requires the embedding app have the platform ACCESS_NETWORK_STATE and CHANGE_NETWORK_STATE permission. -
startMonitoring
Deprecated.Deprecated, use startMonitoring with fieldTrialsStringString argument. -
startMonitoring
Deprecated.Deprecated, pass in application context in startMonitoring instead. -
stopMonitoring
public void stopMonitoring()Stop network monitoring. If no one is monitoring networks, destroy and reset networkChangeDetector. -
addNetworkObserver
Deprecated.Use getInstance(appContext).addObserver instead.Adds an observer for any connection type changes. -
addObserver
-
removeNetworkObserver
Deprecated.Use getInstance(appContext).removeObserver instead.Removes an observer for any connection type changes. -
removeObserver
-
isOnline
public static boolean isOnline()Checks if there currently is connectivity. -
getNumObservers
public int getNumObservers()
-