NetworkMonitor

open class 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.

Types

Link copied to clipboard
interface NetworkObserver
Alerted when the connection type of the network changes.

Functions

Link copied to clipboard
Adds an observer for any connection type changes.
Link copied to clipboard
Link copied to clipboard
Returns the singleton instance.
Link copied to clipboard
open fun init(context: Context)
Link copied to clipboard
open fun isOnline(): Boolean
Checks if there currently is connectivity.
Link copied to clipboard
Removes an observer for any connection type changes.
Link copied to clipboard
Link copied to clipboard
Set the factory that will be used to create the network change detector.
Link copied to clipboard
open fun startMonitoring()
Deprecated, pass in application context in startMonitoring instead.
open fun startMonitoring(applicationContext: Context)
Deprecated, use startMonitoring with fieldTrialsStringString argument.
open fun startMonitoring(applicationContext: Context, fieldTrialsString: String)
Enables auto detection of the network state change and brings up mobile networks for using multi-networking.
Link copied to clipboard
open fun stopMonitoring()
Stop network monitoring.