Let ionic app talk to you mobile network.

Its time to track your mobile network by using ionic in app plugin. In fact, you can get the exact network type of your mobile devices for your ionic app by using a handy plugin “CORDOVA-PLUGIN-NETWORK-INFORMATION”.

To get this plugin inside your app, run the below command

cordova plugin add cordova-plugin-network-information

To get this plugin working, you might need to import $cordovaNetwork

There are few predefined methods to use this plugin which will tell you about the network connection.

  • getNetwork(): This method will exactly tell you the current netowk type if found, otherwise you will get “none” as string
  • isOnline(): is used to check if you are getting a working connection or not
  • isOffline(): just opposite of isOnline().

There are two more methods which fire your desired function when you comes online or goes offline.

For more information please visit :- http://ngcordova.com/docs/plugins/network/

Thanks for your valuable time !