AdMob iOS

From POKKT DOCUMENTATION
Jump to: navigation, search

AdMob Pokkt Mediation

Last Update: 4th June, 2018


Pokkt SDK version used: 7.2.0

AdMob SDK version used: 7.31.0 (GDPR Compliance)


Download Latest Version Pokkt Mediation.


  1. Common AdMob Pokkt Mediation:This is common documentation which is useful for all plugin.
  2. Xamarin Integration:Check the Steps Mentioned for Native.
  3. AIR Integration: Check the Steps Mentioned for AIR.
  4. Marmalade Integration:Check the Steps Mentioned for Marmalade.
  5. ShiVa Integration:There is no separate documentation needed, once you have exported the Xcode project, use the steps mentioned for Native integration.
  6. Cocos2d-x Integration:There is no separate documentation needed, use the steps mentioned for Native integration.
  7. Unity3D Integration:There is no separate documentation needed, once you have exported the Xcode project, use the steps mentioned for Native integration.
  8. Titanium Integration:There is no separate documentation needed, once you have exported the Xcode project, use the steps mentioned for Native integration.

Common Steps for AdMob Pokkt Mediation

Step 1: Configure Pokkt Dashboard

  • Create account at https://www.pokkt.com
  • To use the AdMob Mediation please enter the following details on Pokkt Dashboard:

    Admob ios config n.jpg


  • Class Name (required):This is the class name that you define inside your application to set up the network. Classname for the network can be set during SDK integration. If you are using Pokkt’s default adaptors for mediation, then class name will be “AdMobNetwork” (you can simply copy-paste it without the quotes).
  • Test Device Id (optional):For testing AdMob and if you want to see test ad for interstitial then please provide test divide Id. You can add multiple device Id with comma (,) separated without any space.
  • ECPM:Put your expected value of ECPM which will in turn rank this network in comparison to other configured networks.
  • Screens (required):Here need to provide “AdMob Ad unit ID”. First create screen name in Pokkt dashboard which will reflect here as screen name so provide “Ad unit ID’here. Now for getting “Ad unit ID”from AdMob, create new monetize app in AdMob dashboard and open that app then there is a option “New Ad Unit”. So create new ad unit which will generate Ad unit ID and that Ad unit ID you need to provide here. This screen name will map with this Ad unit ID. Provide your Ad unit IDas screen in Pokkt dashboard.

    Admob screen n.jpg

Note: For More Detail, Please follow the below link

https://support.google.com/admob/answer/3052638

  • Publisher Id (For Reporting): This is AdMob publisher Id. Once you create AdMob account, in right top corner you will see this publisher id.
  • Client Id, Client secret and Refresh token (For Reporting): Please follow the below process
    1. Open the Google API Console Credentials page.
    2. From the project drop-down, select an existing project or create a new one.
    3. On the Credentials page, select Create credentials, then select OAuth client ID.
    4. Under Application type, choose Web application.
    5. Under Authorized redirect URIs, add a line with: https://developers.google.com/oauthplayground
    6. Click Create.
    7. Take note of the client ID and client secret. Same you need to provide here.

Refresh Token:

  1. Go to the OAuth2 Playground via this link, which should pre-populate some key values for you.
  2. Click the gear icon in the upper right corner and check the box labeled Use your own OAuth credentials (if it isn't already checked).
  3. Enter the OAuth2 client ID and OAuth2 client secret you obtained above.

    Admob oauth config.jpg

  4. In the section labeled Step 1 - Select & authorize APIs, enter the following URL in
  5. the text box at the bottom, if it's not already there, then click Authorize APIs:
    https://www.googleapis.com/auth/adsense.readonly

    Admob oauth step1.jpg

  6. If prompted, log in to the account to which you want to grant access and authorization. Otherwise, confirm that the current Google user in the top right corner is the AdWords or manager account for whom you want to obtain credentials.
  7. A prompt appears indicating your app would like to Manage your AdWords Campaigns. Click Accept to continue.
  8. In the tab labeled Step 2 - Exchange authorization code for tokens, you should now see an Authorization code. Click Exchange authorization code for tokens

    Admob oauth step2.jpg

  9. If all goes well, you should see the Refresh token and Access token filled in for you (you may have to re-expand Step 2 - Exchange authorization code for tokens to see these values).

    Admob oauth step2 a.jpg

  10. Copy the Refresh token into the configuration file for your client library of choice, along with the client ID and client secret. See the instructions above to set configuration options for your client library of choice.

Notes:

  1. If you got your client ID and secret only a few minutes ago, and you get an error such as Error: redirect_uri_mismatch, it's possible the changes you made haven't yet propagated. Click the back button in your browser, wait a few minutes, then try clicking Authorize APIs again.
  2. You need to enable AdSense API so please go to AdSense Management API and enable this.

For more details about AdMob reporting, please see AdMob reporting documentation:


Step 2: Configuration in Application

  • Download the mediation project from POKKT and it is recommended to use the same class file AdMobNetworkin your project. And if you want to do some changes please do those changes in same file.
  • Add the “GoogleMobileAds SDK”file into your project. Make sure to update your project's dependencies accordingly.
  • Add the following frameworks to your project.

    - AdSupport

    - AudioToolbox

    - AVFoundation

    - CoreGraphics

    - CoreMedia

    - CoreTelephony

    - EventKit

    - EventKitUI

    - MediaPlayer

    - MessageUI

    - StoreKit

    - SystemConfiguration


Xamarin iOS

Follow the below steps to integrate Mediation in Xamarin iOS project:

  1. Copy downloaded file libAdMobExtension.a in your project folder.
  2. Open project option by right click on your project and select “iOS Build” from left pane and then add the libAdMobExtension.a details and required framework of AdMob inside “Additional mtouch arguments” like below. This is working so you can try with this also.
  3. -gcc_flags "-F${ProjectDir} -framework GoogleMobileAds -framework CFNetwork - framework CoreGraphics -framework AudioToolbox -framework EventKitUI -framework MessageUI -weak_framework StoreKit -L${ProjectDir} -lAdMobExtension -force_load $ {ProjectDir}/libAdMobExtension.a"
  4. Add CFNetwork framework inside project folder also if needed.
  5. Follow above all process to complete integration.

Marmalade iOS

Follow the below steps to integrate Mediation in Marmalade iOS project:

  1. Ensure that you have “libAdMobExtension.a”added in your main project and added .mkbfile, ref:
    • iphone-link-lib='AdMobExtension'
    • iphone-link-libdir=‘$CWD’
    • And AdMob framework (which you need to download from AdMob support site) also need to be added like below under deployment section and also need to add required frameworks:
    • iphone-link-opts="-F$CWD -framework GoogleMobileAds”
    • For more details, please check our given sample app.
  2. If you see error related to CFNetwork framework not found then please add CFNetwork framework in your project folder and update .mkbfile like below:

    iphone-link-opts="-F$CWD -framework CFNetwork”.

  3. Follow above all process to complete integration and also check our given example.