Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/szq4119/react-native-async-http
https://github.com/szq4119/react-native-async-http
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/szq4119/react-native-async-http
- Owner: szq4119
- Created: 2016-01-18T08:55:19.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-18T09:00:53.000Z (almost 9 years ago)
- Last Synced: 2024-11-09T08:18:18.896Z (about 1 month ago)
- Language: Java
- Size: 11.8 MB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-react-native - react-native-async-http ★5 - React Native component for async-http (Components / Backend)
- awesome-react-native - react-native-async-http ★5 - React Native component for async-http (Components / Backend)
- awesome-react-native - react-native-async-http ★5 - React Native component for async-http (Components / Backend)
- awesome-react-native-ui - react-native-async-http ★3 - React Native component for async-http (Components / Backend)
- awesome-react-native - react-native-async-http ★5 - React Native component for async-http (Components / Backend)
README
# react-native-async-http
###Asynchronous Http Client for Android
[https://github.com/loopj/android-async-http](https://github.com/loopj/android-async-http)
## Installation```bash
npm install react-native-async-http@latest --save
```## Getting started - Android
* In `android/setting.gradle`
```gradle
...
include ':react-native-async-http'
project(':react-native-async-http').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-async-http/android')
```* In `android/app/build.gradle`
```gradle
...
dependencies {
...
compile project(':react-native-async-http')
}
```* register module (in MainActivity.java)
```java
import com.smccz.asynchttp.AsyncHttpAndroidPackage; // <--- importpublic class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
......@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mReactRootView = new ReactRootView(this);mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setBundleAssetName("index.android.bundle")
.setJSMainModuleName("index.android")
.addPackage(new MainReactPackage())
.addPackage(new AsyncHttpAndroidPackage()) // <------ add here
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();mReactRootView.startReactApplication(mReactInstanceManager, "example", null);
setContentView(mReactRootView);
}......
}
```