Network
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 ...
- Returns: The
Get Ionic : Hybrid Mobile App Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.