Admob sample for React Native.
-
clone repo
git clone https://github.com/melihmucuk/react-native-admob-sample.git
-
run
npm install
command on root folder -
edit index.ios.js
var BannerAdUnitId = 'Your Banner Ad Unit ID'; var InterstitialAdUnitId = 'Your Interstitial Ad Unit ID';
- Please follow admob ios tutorial here Note: if you install admob via PodFile, then you will need to do the following: Add ‘$(inherited)’ to Build settings-> Other Linker Flags
- Copy
AdMobManager.h
andAdMobManager.m
files to your project. - Then follow
Usage
section
-
require
NativeModules
var AdMob = require('NativeModules').AdMobManager;
-
for loading Interstitial Ad
AdMob.loadInterstitial(InterstitialAdUnitId);
-
for showing Interstitial Ad
AdMob.showInterstitial();
-
for showing Banner Ad
AdMob.showBannerOnBottomOfTheView(BannerAdUnitId);
Before showing Interstitial Ads, you have to call loadInterstitial
func.
react-native: 0.0.9
google admob ios sdk: 7.4.1