Supported AdMob Version: 7.16
Supported Ad Formats: The VMAX SDK supports Admob Native Advanced Ads . Considering discontinuation (https://developers.google.com/admob/android/native-express) of AdMob Express ads we have removed the support for the same.
You will need
- an active AdMob account
- Ad unit ID
- Refresh Token
In your AdMob Account
To find the ad unit ID, click the Monetize tab. Select an app from the list of apps in the sidebar. The ad unit ID is listed below the ad unit name.
Read more on how to get your refresh token here.
Step 1: Integrate the VMAX Library Adapters from the Adapters .zip folder.
- VMaxGoogleMobileAdsBannerAdapter.h and VMaxGoogleMobileAdsBannerAdapter.m
- VMaxGoogleMobileAdsInterstitialAdapter.h and VMaxGoogleMobileAdsInterstitialAdapter.m
- VMaxGoogleMobileAdsNativeAdapter.h and VMaxGoogleMobileAdsNativeAdapter.m
Step 2: Integrate the main framework file GoogleMobileAds.framework.
Step 3: Integrate the dependent framework files
Additional steps for AdMob Advanced Native ads
1. Display an ad having custom Layout:
For displaying the ad having custom layout, we need to follow this section in order to ensure that SDK is able to mediate with AdMob Native ads.
Admob FrameWork(GoogleMobileAds Framework) provides classes named GADNativeAppInstallAdView & GADNativeContentAdView for app install ads and content ads respectively.
These ad view classes are UIViews to display ads of the corresponding format. Each of the UIViews used to display that ads assets should be children of that GADNativeAppInstallAdView or GADNativeContentAdView object.
Ad SDK expects the view hierarchy something like this:
The GADNativeAppInstallAdView & GADNativeContentAdView provide IBOutletsused to register the view used for each individual asset and registering the views in this way is mandatory to allow the AdMob SDK allow to automatically handle tasks such as:
- Recording clicks.
- Recording impressions (when the first pixel is visible on the screen).
- Displaying the AdChoices overlay.
Lay out UIViews in the xib file :
In order to lay out the UIViewsfor displaying native ad assets we can used interface Builder as you would when creating any other xib file.
Here’s an example layout for an app install ad:
As shown in above screenshot set Custom Class value at the top right of the images. It should be set to GADNativeAppInstallAdViewfor Native Install ad.
As shown in above screenshot set Custom Class value at the top right of the images. It should be set to GADNativeContentAdViewfor content ad.
Link the outlets to the views :
Once the views are in place and you’ve assigned the correct ad view class to the layout, link the ad view’s asset outlets to the UIViewsyou’ve created. Here’s how you might link the ad view’s asset outlets to the UIViewscreated for an app install ad and content ad respectively.
In the outlet panel, the IBOutlets in GADNativeAppInstallAdViewhave been linked to the UIViewslaid out in the Interface Builder. This lets the SDK know which UIViewdisplays which asset. It’s also important to remember that these outlets represent the views that are clickable in the ad.
In order for Ad SDK to understand container of the ad make sure to tag the container like below:[_nativeAdContainer setTag:vmax_native_Container];
Please follow Native custom guideline for understanding steps involved in tagging other ad assets and API’s required to show the ad here.