O'Reilly logo

Getting Started with Ionic by Rahat Khanna

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required