react-native-xunfei-voice-sdk
v1.0.4
Published
wrap xunfei-voice-sdk
Downloads
13
Maintainers
Readme
react-native-network-info
React Native library for getting information about the devices network
Installation
npm install react-native-network-info --save
or
yarn add react-native-network-info
Automatic Install
react-native link
Manual Install
iOS
In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]
Go to node_modules ➜ react-native-network-info and add the .xcodeproj file
Add
RNNetworkInfo.a
toBuild Phases -> Link Binary With Libraries
Run your project (Cmd+R)
Android
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')
Update the android build tools version to
2.2.+
inandroid/build.gradle
:buildscript { ... dependencies { classpath 'com.android.tools.build:gradle:2.2.+' // <- USE 2.2.+ version } ... } ...
Update the gradle version to
2.14.1
inandroid/gradle/wrapper/gradle-wrapper.properties
:... distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
Add the compile line to the dependencies in
android/app/build.gradle
:dependencies { ... compile project(':react-native-network-info') }
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 ); } }
Usage
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.