react-native-instream-android
Instream Facebook ads for React Native android
Note: this project is Android only, and not a Component Module, just a method to show Ads activity on top of your React Native app
Installation Process
- download this from npm
npm install react-native-instream-android --save
-
Follow all the steps in the Getting Started Guide for Facebook SDK and Getting Started Guide for Facebook Audience for Android.
-
Run
react-native link
to automatically link the library.
manual link process
-
Edit
android/settings.gradle
:+ include ':react-native-instream-android'+ project(':react-native-instream-android').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-instream-android/android') -
Edit
android/app/build.gradle
:dependencies {compile fileTree(dir: 'libs', include: ['*.jar'])compile "com.android.support:appcompat-v7:23.0.1"compile "com.facebook.react:react-native:+"+ compile project(':react-native-instream-android')} -
Edit
android/app/src/main/java/.../MainApplication.java
:+ import com.rninstreamandroid.RNInstreamAndroidPackage;@Overrideprotected List<ReactPackage> getPackages() {return Arrays.<ReactPackage>asList(new MainReactPackage()+ , new RNInstreamAndroidPackage());}
Usage
// or// orconst Instream = // methods (Android only, will throw Error on iOS) // callback typeInstream; // promise typeInstream;