It takes 3 simple steps to start monetizing:
- Add your app to our system and get your Media Id
- Add the package to your project
- Implement Start Session and Ad Unit code
You can find more details about RevMob's package integration at Official RevMob documentation
###Requirements react-native 0.25.0 or newer
Using rnpm:
- Using your terminal, go to your project directory and enter the command:
npm install --save react-native-revmob react-native link- Add the file
RevMobAds.frameworkthat is included inside the ios folder (yourProject/node_modules/react-native-revmob/ios) to your project. - (Optional) Add RevMob's Fullscreen Activity to your
AndroidManifest.xml:
<activity android:name="com.revmob.FullscreenActivity" android:theme="@android:style/Theme.Translucent" android:configChanges="keyboardHidden|orientation"> </activity>npm i react-native-revmob -S- Add the file
RevMobAds.frameworkthat is included inside the ios folder (yourProject/node_modules/react-native-revmob/ios) to your project. - Add
react-native-revmobstatic library to your Xcode project: Official React Native guide (Step 3 not needed).
npm i react-native-admob -S- Add the following lines to the given files:
android/settings.gradle
include ':react-native-revmob' project(':react-native-revmob').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-revmob/android') android/app/build.gradle
dependencies { ... compile project(':react-native-revmob') } MainActivity.java
import com.rctrevmob.RevMobPackage; // Add this import ... protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new RevMobPackage() // Add this line ); }For more information, see the example project: Sample App
import { RevMobManager } from 'react-native-revmob'; // Methods: RevMobManager.startSession('YOUR-MEDIA-ID', callback); RevMobManager.loadFullscreen(); RevMobManager.showPreLoadedFullscreen(); RevMobManager.showBanner(); RevMobManager.hideBanner(); RevMobManager.loadVideo(); RevMobManager.showVideo(); RevMobManager.loadRewardedVideo(); RevMobManager.showRewardedVideo(); RevMobManager.loadAdLink(); RevMobManager.openLoadedAdLink();For more information, please refer to the official documentation
Be sure to also join the developer community on our forum.