Skip to content

szq4119/react-native-async-http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

react-native-async-http

###Asynchronous Http Client for Android
https://github.com/loopj/android-async-http

Installation

npm install react-native-async-http@latest --save

Getting started - Android

  • In android/setting.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
...
dependencies {
    ...
    compile project(':react-native-async-http')
}
  • register module (in MainActivity.java)
import com.smccz.asynchttp.AsyncHttpAndroidPackage; // <--- import

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

  ......

}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published