<commit_before># react-native-network-info

React Native library for getting information about the devices network

## Installation

```javascript
npm install react-native-network-info --save
```
or

```javascript
yarn add react-native-network-info
```

### `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`:
    ```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`:
    ```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`:
    ```gradle
    dependencies {
        ...
        compile project(':react-native-network-info')
    }
    ```

5. Add the import and link the package in `MainApplication.java`:
    ```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
            );
        }
    }
    ```

## Usage

```javascript

// require module
var NetworkInfo = require('react-native-network-info');

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

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

```

## Dev Notes
Notes on how this package was made can be [found here](http://eastcodes.com/packaging-and-sharing-react-native-modules "Packaging and Sharing React Native Modules").<commit_msg>(docs) updated usage example to use imports<commit_after># react-native-network-info

React Native library for getting information about the devices network

## Installation

```javascript
npm install react-native-network-info --save
```
or

```javascript
yarn add react-native-network-info
```

### `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`:
    ```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`:
    ```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`:
    ```gradle
    dependencies {
        ...
        compile project(':react-native-network-info')
    }
    ```

5. Add the import and link the package in `MainApplication.java`:
    ```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
            );
        }
    }
    ```

## Usage

```javascript

// require module
import NetworkInfo from 'react-native-network-info';

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

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

```

## Dev Notes
Notes on how this package was made can be [found here](http://eastcodes.com/packaging-and-sharing-react-native-modules "Packaging and Sharing React Native Modules").
{'fraction_non_alphanumeric': 0.13277241945413504, 'fraction_numerical': 0.009029345372460496, 'mean_word_length': 2.8590657165479016, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '997015', 'n_tokens_mistral': 1503, 'n_tokens_neox': 1438, 'n_words': 396}