this is mopub react native library
npm install react-native-mopub-sdk$ npm install react-native-mopub-sdk --save
$ react-native link react-native-mopub-sdk
pod init
`
2. It will create Podfile in your project, open it and paste the following lines below target 'PROJECT_NAME' do.
`
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # Needed for debugging
'RCTAnimation', # Needed for FlatList and animations running on native UI thread
Add any other subspecs you want to use in your project
]
Explicitly include Yoga if you are using RN >= 0.42.0
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
Third party deps podspec link
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
pod 'react-native-mopub-sdk', path: '../node_modules/react-native-mopub-sdk'
`
3. Then run the following command in termainal in the same location
`
pod install
`
$3
1. Add following permissions to your android AndroidManifest.xml.
`
`
2. Declare the following activities in your AndroidManifest.xml.
`
android:value="15.0.90" />
`
3. Add following lines to build.gradle allprojects➜ repositories
`java
maven { url "https://s3.amazonaws.com/moat-sdk-builds" }
maven { url 'https://adcolony.bintray.com/AdColony' }
maven { url 'https://tapjoy.bintray.com/maven' }
maven { url 'https://jitpack.io' }
`
Usage
$3
`javascript
import {RNMoPubInterstitial} from 'react-native-mopub-sdk';
`
$3
| Mehod | Description |
| --- | --- |
| initializeInterstitialAd (adUnitId: string) | Initialize Interstitial ad for the the given ad unit. |
| loadAd () | Loads ad for the unit provided through initialization. |
| setKeywords (keywords: string) | Set keyword for the ad. |
| isReady () | Return a promise to check whether Interstitial is ready. |
| show () | Shows Interstitial if loaded. |
| addEventListener (eventType: string, listener: Function) |Adds listener to the events from Interstitial ad, possible event names are "onLoaded" "onFailed", "onClicked", "onShown" and "onDismissed".|
|removeAllListeners (eventType: string)|Remove listeners for added for events from Interstitial ad.|
$3
`javascript
import {MoPubBanner} from 'react-native-mopub-sdk';
``