Skip to main content

Network Events

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

Sample​

The current network state is accessible through Wisej.Hybrid.Device.Networking.

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

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

Monitor Network Events​

It's possible to monitor changes in the network state using Device.Networking. The ConnectivityChanged event is a plain EventHandler; read the updated values from Device.Networking in the handler:

Device.Networking.ConnectivityChanged += Networking_ConnectivityChanged;

private void Networking_ConnectivityChanged(object sender, EventArgs e)
{
NetworkAccess access = Device.Networking.NetworkAccess;
ConnectionProfile[] profiles = Device.Networking.ConnectionProfiles;
}
warning

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​

API reference​

Device API. See Platform Capabilities before relying on native behavior.