Need help upgrading to Ionic Framework 4.0? Get assistance with our Enterprise Migration Services EXPLORE NOW

Network Interface

Improve this doc

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

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

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-plugin-networkinterface
    $ npm install --save @ionic-native/network-interface@4
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { NetworkInterface } from '@ionic-native/network-interface';

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}`));
}

Instance Members

getWiFiIPAddress()

Gets the WiFi IP address

Returns: Promise<any> Returns a Promise that resolves with the IP address information.

getCarrierIPAddress()

Gets the wireless carrier IP address

Returns: Promise<any> Returns a Promise that resolves with the IP address information.

getHttpProxyInformation(message)

Gets the relevant proxies for the passed URL in order of application

Param Type Details
message url

The message to display.

Returns: Promise<any> Returns a Promise that resolves with the proxy information.

API

Native

General