The network device plugin helps in identifying the network on which the device is connected and listening to network change events. The $cordovaNetwork
is a service of the ngCordova module, which exposes multiple methods and events for managing the network.
The command line to be executed using the Ionic/Cordova CLI is:
cordova plugin add cordova-plugin-network-information
The methods available under this service are:
Method Name:
getNetwork()
Returns: The
Connection
object (this property determines the connection state and connection type)The possible connection types can be:
Type
Description
Connection.UNKNOWN
Unknown connection
Connection.ETHERNET
Ethernet connection
Connection.WIFI
Wi-Fi connection
Connection.CELL_2G
Cell 2G connection
Connection.CELL_2G
Cell 3G connection
Connection.CELL_2G
Cell 4G connection
Connection.CELL
Cell generic connection
Connection.NONE
No network connection
Method Name:
isOnline()
Returns: Boolean (
true
if network is online)
Method...