Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public interface NetworkTypeListener

Receives notifications when the device’s active network changes type (WiFi <-> Cellular <-> Ethernet <-> None <-> VPN). Register with NetworkManager.addNetworkTypeListener(NetworkTypeListener).

Implementations are invoked on the EDT.

Methods

public abstract void onNetworkTypeChanged(int oldType, int newType, boolean vpnActive)Called when the platform transitions between network classes.

Method details

onNetworkTypeChanged

public abstract void onNetworkTypeChanged(int oldType, int newType, boolean vpnActive)
Called when the platform transitions between network classes.

Parameters

oldType int
one of NetworkManager.NETWORK_TYPE_*
newType int
one of NetworkManager.NETWORK_TYPE_*
vpnActive boolean
true if the platform reports a VPN tunnel on top of the active network. May be false on platforms where VPN detection is unsupported (see NetworkManager.isVPNDetectionSupported()).