All Projects → pusherman → React Native Network Info

pusherman / React Native Network Info

Licence: mit
React Native library for getting information about the devices network

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to React Native Network Info

Ecs
ECS for Unity with full game state automatic rollbacks
Stars: ✭ 151 (-51.76%)
Mutual labels:  network, networking
Simplenet
An easy-to-use, event-driven, asynchronous network application framework compiled with Java 11.
Stars: ✭ 164 (-47.6%)
Mutual labels:  network, networking
Ccna60d
60天通过思科认证的网络工程师考试
Stars: ✭ 155 (-50.48%)
Mutual labels:  network, networking
Netfil
A kernel network manager with monitoring and limiting capabilities for macOS. #nsacyber
Stars: ✭ 97 (-69.01%)
Mutual labels:  network, networking
Enet
⚡️ ENet reliable UDP networking library
Stars: ✭ 202 (-35.46%)
Mutual labels:  network, networking
Solarnetwork
Elegant network abstraction layer in Swift.
Stars: ✭ 99 (-68.37%)
Mutual labels:  network, networking
Iptools
PHP Library for manipulating network addresses (IPv4 and IPv6)
Stars: ✭ 163 (-47.92%)
Mutual labels:  network, networking
Avenue
Wrapper around URLSession and URLSessionTask to enable seamless integration with Operation / OperationQueue.
Stars: ✭ 58 (-81.47%)
Mutual labels:  network, networking
Scaproust
Implementation of the nanomsg "Scalability Protocols" in rust.
Stars: ✭ 183 (-41.53%)
Mutual labels:  network, networking
Txeh
Go library and CLI utilty for /etc/hosts management.
Stars: ✭ 181 (-42.17%)
Mutual labels:  network, networking
Gns3 Gui
GNS3 Graphical Network Simulator
Stars: ✭ 1,307 (+317.57%)
Mutual labels:  network, networking
Fire
🔥A delightful HTTP/HTTPS networking framework for iOS/macOS/watchOS/tvOS platforms written in Swift.
Stars: ✭ 243 (-22.36%)
Mutual labels:  network, networking
Stnettaskqueue
STNetTaskQueue is a networking queue library for iOS and OS X. It's abstract and can be implemented in different protocols.
Stars: ✭ 90 (-71.25%)
Mutual labels:  network, networking
Ruffles
Lightweight and fully managed reliable UDP library.
Stars: ✭ 131 (-58.15%)
Mutual labels:  network, networking
Pynms
A vendor-agnostic NMS for carrier-grade network simulation and automation
Stars: ✭ 73 (-76.68%)
Mutual labels:  network, networking
Litenetlib
Lite reliable UDP library for Mono and .NET
Stars: ✭ 2,179 (+596.17%)
Mutual labels:  network, networking
React Native Netinfo
React Native Network Info API for Android & iOS
Stars: ✭ 1,049 (+235.14%)
Mutual labels:  network, networking
Macfinder
An iOS Library that helps you find the MAC Address of a specific IP
Stars: ✭ 57 (-81.79%)
Mutual labels:  network, networking
Medium
Independent telecommunication environment
Stars: ✭ 171 (-45.37%)
Mutual labels:  network, networking
Golden Gate
Framework to connect wearables and other IoT devices to mobile phones, tablets and PCs with an IP-based protocol stack over Bluetooth Low Energy
Stars: ✭ 223 (-28.75%)
Mutual labels:  network, networking

react-native-network-info

React Native library for getting information about the devices network

Requirements

Version 3+ requires RN 0.47 or higher Version 2+ requires RN 0.40 - RN 0.46

Installation

npm install react-native-network-info --save

or

yarn add react-native-network-info

Linking the library

Using React Native >= 0.60

Linking the package manually is not required anymore with Autolinking.

iOS also requires CocoaPods install

$ cd ios && pod install && cd ..

Using React Native < 0.60

$ react-native link react-native-network-info

Usage

import {NetworkInfo} from 'react-native-network-info';

// Get Local IP
NetworkInfo.getIPAddress().then(ipAddress => {
  console.log(ipAddress);
});

// Get IPv4 IP (priority: WiFi first, cellular second)
NetworkInfo.getIPV4Address().then(ipv4Address => {
  console.log(ipv4Address);
});

// Get Broadcast
NetworkInfo.getBroadcast().then(broadcast => {
  console.log(broadcast);
});

// Get SSID
NetworkInfo.getSSID().then(ssid => {
  console.log(ssid);
});

// Get BSSID
NetworkInfo.getBSSID().then(bssid => {
  console.log(bssid);
});

// Get Subnet
NetworkInfo.getSubnet().then(subnet => {
  console.log(subnet);
});

// Get Default Gateway IP
NetworkInfo.getGatewayIPAddress().then(defaultGateway => {
  console.log(defaultGateway);
});

// Get frequency (supported only for Android)
NetworkInfo.getFrequency().then(frequency => {
  console.log(frequency);
});

Manually Linking the Library

If react-native link fails and you are not using the auto linking provided in React Native >= 0.60

iOS

  1. In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]

  2. Go to node_modules ➜ react-native-network-info and add the .xcodeproj file

  3. Add RNNetworkInfo.a to Build Phases -> Link Binary With Libraries

Run your project (Cmd+R)

Android

  1. Add the following lines to android/settings.gradle:

    include ':react-native-network-info'
    project(':react-native-network-info').projectDir = new File(settingsDir, '../node_modules/react-native-network-info/android')
    
  2. Update the android build tools version to 2.2.+ in android/build.gradle:

    buildscript {
        ...
        dependencies {
            classpath 'com.android.tools.build:gradle:2.2.+' // <- USE 2.2.+ version
        }
        ...
    }
    ...
    
  3. Update the gradle version to 2.14.1 in android/gradle/wrapper/gradle-wrapper.properties:

    ...
    distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
    
  4. Add the compile line to the dependencies in android/app/build.gradle:

    dependencies {
        ...
        compile project(':react-native-network-info')
    }
    
  5. Add the import and link the package in MainApplication.java:

    import com.pusherman.networkinfo.RNNetworkInfoPackage; // <-- add this import
    
    public class MainApplication extends Application implements ReactApplication {
        @Override
        protected List<ReactPackage> getPackages() {
            return Arrays.<ReactPackage>asList(
                new MainReactPackage(),
                new RNNetworkInfoPackage() // <-- add this line
            );
        }
    }
    

Dev Notes

Notes on how this package was made can be found here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].