Network Events

Wisej.NET Hybrid applications support monitoring the current network status of the Hybrid device.

Sample

The current network state is accessible using the Info member of the Device singleton (Wisej.Hybrid.Device.Info).

// can the device connect to the internet:
NetworkAccess access = Device.Info.Networking.NetworkAccess;

// Cellular, WiFi, Ethernet, etc.
ConnectionProfile[] profiles = Device.Info.Networking.ConnectionProfiles;

Monitor Network Events

It's possible to monitor changes in the network state using Device.Networking.

Device.Info.Networking.ConnectiivtyChanged += (s, e) => 
{
    NetworkAccess access = e.NetworkAccess;
    ConnectionProfile[] profiles = e.ConnectionProfiles;
};

Keep in mind, monitoring NetworkAccess may not work when using an online application as the application may not be able to connect to the remote web server.

Further Reading

.NET MAUI Connectivity

Last updated