Use this API to listen for network status changes. Listening starts automatically when the API is called; the callback interval is 500 ms. Call my.offNetworkStatusChange to stop listening.
Parameters
Property
Type
Required
Description
listener
Function
Yes
Callback invoked when the network status changes
Listener Callback
Property
Type
Description
isConnected
Boolean
Whether the network is connected
networkType
String
Network type: UNKNOWN, NOTREACHABLE, WWAN, WIFI, 2G, 3G, 4G, 5G. On Android, UNKNOWN is returned if the permission to read phone information is set to “ask” or “deny”
signalStrength
Number
Signal strength in dBm, only when networkType is WIFI. Android only