iOS SDK AdMob Adapter

1607 views 2019-06-20 Ofer Garnett 0

Getting Started

Latest iOS version: 5.0.0
Release date: 27-Nov 2019

This document details the process of integrating YouAppi iOS AdMob adapter with your iOS app.

If you have any questions, please, feel free to email us: [email protected]

Setup

Automatic: Setup your project with CocoaPods

You can setup your project with YouAppi’s SDK automatically using CocoaPods.

Steps for using CocoaPods:

  • Make sure CocoaPods is installed on your Mac.
  • Make sure your project has a pod file.
  • Add to your pod file YouAppi’s framework and YouAppi’s AdMob adapter:

    target 'MyApp' do
      pod 'YouAppiMoatSDK'
      pod 'YouAppiAdMobAdapter'
      pod 'Google-Mobile-Ads-SDK'
      pod 'PersonalizedAdConsent'
    end
  • Please note that: Google-Mobile-Ads-SDK and PersonalizedAdConsent might have already been added to your pod file if you are working with AdMob mediation.
  • Open a terminal and change the current directory to your project directory.
  • Run the command:

    pod install
  • After YouAppi framework is setup for your project, you can move on to the integration section of the document.

Manual: Setup your project for YouAppi’s SDK

  • YouAppi SDK and YouAppi AdMob adapter can be found in YouAppi iOS SDK zip file.
  • Install YouAppi iOS SDK as described in the document.
  • Add YouAppiMoat.framework and libYouAppiAdMob.a static library to your project.
  • After YouAppi framework is setup for your project, you can move on to the integration section of the document.

Create a new iOS app

  • On ad mob platform go to apps section.
  • Press ADD APP button.

  • Follow through the steps of creating a new app.

Add to your iOS app ad units

Add new ad units to your app by choosing your app and pressing ADD AD UNIT button

Rewarded Video

  • After pressing ADD AD UNIT button select Rewarded:

  • Fill your ad unit details and press CREATE AD UNIT button:

Interstitial Video and Interstitial Ad

  • After pressing ADD AD UNIT button select Interstitial

  • Fill your ad unit details and press CREATE AD UNIT button:

Create Mediation Group for YouAppi Rewarded Video

  • Choose Mediation tab and press CREATE MEDIATION GROUP button.
  • Fill mediation group details and press CONTINUE:

  • Fill mediation group details and press ADD AD UNITS to connect your mediation group with the rewarded video ad unit.

  • Press DONE to add the ad unit.
  • After the popup is closed and the ad unit is selected, on Ad Sources section press ADD CUSTOM EVENT button.
  • On the popup name your custom event, fill relevant eCPN and press CONTINUE:

  • On the next popup fill the class name of YouAppi rewarded video custom event: YAAdMobRewardedVideoAdEvent
  • Fill the Parameter field with a JSON containing information about your access token and ad unit id. For example:

{ "accessToken": "821cfa77-3127-42b5-9e6b-0afcecf77c69", "adUnitId": "tesRewardedVideoAdUnit" }

  • Make sure to use your access token and to put ad unit id that contains only letters, numbers or underscores.

  • Press DONE to save the custom event.
  • Press SAVE to create the new mediation group.

Create Mediation Group for YouAppi Interstitial Video and Interstitial Ad

  • Choose Mediation tab and press CREATE MEDIATION GROUP button.
  • Fill mediation group details and press CONTINUE:

  • Fill mediation group details and press ADD AD UNITS to connect your mediation group with the interstitial ad and interstitial video ad units.

  • Press DONE to add the ad unit.
  • After the popup is closed and the ad unit is selected, on Ad Sources section press ADD CUSTOM EVENT button.
  • On the popup name your custom event, fill relevant eCPN and press CONTINUE:

  • On the next popup fill the class name of YouAppi rewarded video custom event: YAAdMobInterstitialVideoAdEvent or YAAdMobInterstitialAdEvent.
  • Fill the Parameter field with a JSON containing information about your access token and ad unit id. For example:

{ "accessToken": "821cfa77-3127-42b5-9e6b-0afcecf77c69", "adUnitId": "tesRewardedVideoAdUnit" }

  • Make sure to use your access token and to put ad unit id that contains only letters, numbers or underscores.

  • Press DONE to add the ad unit.
  • Press SAVE to create the new mediation group.

Use AdMob SDK to show YouAppi ad units

Rewarded Video

Load

[GADRewardBasedVideoAd sharedInstance].delegate = self;
[[GADRewardBasedVideoAd sharedInstance] loadRequest:[GADRequest request] withAdUnitID:@"Ad Unit ID From AdMob"];

Show

if ([[GADRewardBasedVideoAd sharedInstance] isReady]) {
  [[GADRewardBasedVideoAd sharedInstance] presentFromRootViewController:self];
}

Interstitial Video

Load

self.interstitialVideoAdMob = [[GADInterstitial alloc] initWithAdUnitID:@"Ad Unit ID From AdMob"];
GADRequest *request = [GADRequest request];
[self.interstitialVideoAdMob loadRequest:request];

Show

if (self.interstitialVideoAdMob.isReady) {
  [self.interstitialVideoAdMob presentFromRootViewController:self];
}

Interstitial Ad

Load

self.interstitialAdAdMb = [[GADInterstitial alloc] initWithAdUnitID:@"Ad Unit ID From AdMob"];
GADRequest *request = [GADRequest request];
[self.interstitialAdAdMb loadRequest:request];

Show

if (self.interstitialAdAdMb.isReady){
  [self.interstitialAdAdMb presentFromRootViewController:self];
}

Demo App

A demo app showing a simple usage of the SDK can be found in the following Github repository:

https://github.com/YouAppi/youappi-sdk-ios-demo

The demo app contains 3 modules:

  • AppDemo – Shows how to use YouAppi’s SDK
  • AppDemoAdMob – Shows how to use YouAppi’s SDK with AdMob adapter
  • AppDemoMoPub – Shows how to use YouAppi’s SDK with MoPub adapter

Please make sure to read the README.md file for further instructions.