Skip to main content
Version: v6

Network Interface

Network interface information plugin for Cordova/PhoneGap that supports Android, Blackberry 10, Browser, iOS, and Windows Phone 8.

https://github.com/salbahra/cordova-plugin-networkinterface

Stuck on a Cordova issue?

Don't waste precious time on plugin issues.

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.

Installation

$ npm install cordova-plugin-networkinterface 
$ npm install @awesome-cordova-plugins/network-interface
$ ionic cap sync

Supported Platforms

  • Android
  • BlackBerry 10
  • Browser
  • iOS
  • Windows
  • Windows Phone

Usage

React

Learn more about using Ionic Native components in React

Angular

import { NetworkInterface } from '@awesome-cordova-plugins/network-interface/ngx';

constructor( private networkInterface: NetworkInterface ) {

this.networkInterface.getWiFiIPAddress()
.then(address => console.info(`IP: ${address.ip}, Subnet: ${address.subnet}`))
.catch(error => console.error(`Unable to get IP: ${error}`));

this.networkInterface.getCarrierIPAddress()
.then(address => console.info(`IP: ${address.ip}, Subnet: ${address.subnet}`))
.catch(error => console.error(`Unable to get IP: ${error}`));

const url = 'www.github.com';
this.networkInterface.getHttpProxyInformation(url)
.then(proxy => console.info(`Type: ${proxy.type}, Host: ${proxy.host}, Port: ${proxy.port}`))
.catch(error => console.error(`Unable to get proxy info: ${error}`));
}