Class NetworkMonitor
Tells when the device's network changed, e.g. another Wi-Fi or mobile data, so that the sync and calls can move to it at once instead of waiting for requests on the old network to time out.
Implements
Inherited Members
Namespace: Uniform.Matrix.Client.Services
Assembly: Uniform.Matrix.Client.dll
Syntax
public sealed class NetworkMonitor : IDisposable
Remarks
Follows .NET's NetworkAddressChanged where the platform supports it; apps whose platform reports changes otherwise, as Android does, call NotifySystemChanged(), which every monitor follows. Changes within Settle of each other are told once.
Constructors
| Edit this page View SourceNetworkMonitor(ILogger<NetworkMonitor>)
Follow the system's address changes where supported.
Declaration
public NetworkMonitor(ILogger<NetworkMonitor> logger)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogger<NetworkMonitor> | logger |
Fields
| Edit this page View SourceSettle
How long to wait for a change to settle before telling, as one switch changes several addresses.
Declaration
public static readonly TimeSpan Settle
Field Value
| Type | Description |
|---|---|
| TimeSpan |
Methods
| Edit this page View SourceDispose()
Stop following the system.
Declaration
public void Dispose()
NotifyChanged()
Tell that the network changed, e.g. from Android's connectivity callbacks.
Declaration
public void NotifyChanged()
NotifySystemChanged()
Tell every monitor that the network changed, e.g. from Android's connectivity callbacks, which run outside the client's services.
Declaration
public static void NotifySystemChanged()
Events
| Edit this page View SourceChanged
Raised once a change settled; on a thread pool thread.
Declaration
public event Action? Changed
Event Type
| Type | Description |
|---|---|
| Action |