Follow

MoPub Plugin Integration

 
Please Note: Dynamic Bidding is only supported in AerServ SDK Version 3.1.5 and higher.
You can get the latest Android and iOS SDKs here.

 

 

Step 1: Download iOS SDK and Required Adapter Files

Download latest AerServ iOS SDK here. The downloaded ZIP file contains both the SDK library and adapter files.

 

Step 2: Configure Your Project

  1. Follow MoPub's instructions on setting up their SDK for your project.
  2. Unzip AerServ SDK ZIP file, and copy aerserv-ios-sdk/lib/AerServSDK.framework into your project's libs folder.
  3. Copy all Objective-C files from aerserv-ios-sdk/network-support/MoPub/AerServCustomEvents into your project's source folder.
  4. You must initialize our SDK. We recommend that you invoke this initialization routine at least 10 seconds before you intend to show your first ad (a good location would be your AppDelegate’s application:didFinishingWithOptions ).
    • To initialize the SDK, invoke the following:

      AerServSdk.init(MainActivity.this, MY_APP_ID);
    • How to obtain the app ID:
      1. Log on to the AerServ platform.
      2. Go to the 'Inventory' tab in the top navigation bar.
      3. Click the 'Edit' icon next to the app whose ID you wish to obtain.
      4. You will find the app ID at the very top of the page.
  5. To set or update the General Data Protection Regulation (GDPR) user consent flag, call AerServSDK’s +setGDPRWithUserConsent: method. Pass YES/true for user consent if GDPR user consent was granted and NO/false if user consent was denied or if unknown. To have the GDPR user consent flag to be set before an ad request, call +setGDPRWithUserConsent: before calling -loadAd. It is not necessary to reset the user consent value prior to each ad request; the value set is applicable for all subsequent requests until that value is reset.

    // Replace YES with the actual consent value of user consent.
    [AerServSDK setGDPRWithUserConsent:YES];

 

Step 3: Configure Ad Settings on AerServ Web Interface

    1. Follow instruction to set up AerServ Placements and Ad Sources.
    2. For banner ads, please set refresh interval to Never. If you want banner refresh, enable it with MoPub instead.
 
Important Note: If you want to enable banner refresh, you should only do so with one SDK. Having refresh on both SDKs will result in duplicate requests. We recommend that you enable it for MoPub and disable it for AerServ.
 

Step 4: Configure Ad Settings on MoPub Web Interface

    1. (Optional) Create a new AdUnit with the ad type that you'll like to use AerServ with. You can use a existing AdUnit if one already exist.
    2. Now go to the 'Orders' tab and click on Create order. Creating a new 'Order' is optional. You can use a existing order if one already exist. If you decide to use a exist order, you will need to create a new Line Item instead.
    3. When creating a new Order/Line Item, use the following parameters:
        • Advertiser: AerServ
        • Type & Priority: Network
        • Network: Custom Native Network
        • Class: Use one of the following class names. If you changed the package name please change the classpath to correspond with the new package name.
          • For Banner: AerServCustomEventBanner
          • For Interstitial: AerServCustomEventInterstitial
          • For Rewarded Video: AerServCustomEventRewardedInterstitial
          • For Native Static: AerServCustomEventNativeAd
        • eCPM: You will need to the eCPM from the AerServ dashboard. If you have any question please contact our support.
        • Data: AerServ ad parameters, in JSON format. This field will take any additional parameter for the AerServ SDK. Refer to Advanced Topics > Server Parameters for more information.
        • Ad Unit: Select the newly created AdUnit created or use existing a AdUnit.

  

Step 5: Request Ads

Follow MoPub instructions to request banner, interstitial, or native static ads, but using ad units that you created in Step 3 above. There are no different or special API calls to fetch AerMarket ads, as all mediation is done automatically for you by the adapters.

 

For Native Static:

The AerServ MoPub Native Plugin utilizes MoPub’s AdPlacer native integration implementation.

When setting up the Ad Placer, an additional render configuration will be passed in for AerServ. Create an AerServCustomNativeAdRendererSettings object. Setting the renderingViewClass and viewSizeHandler properties. Then utilizing the newly created settings create a MPNativeAdRendererConfiguration object with the static method +rendererConfigurationWithRenderSettings: from AerServCustomNativeAdRenderer. Add this render configuration object into the render configuration array that’s passed into your ad placer.

// setup AerServNativeAdRendererSettings
AerServNativeAdRendererSettings* asNativeSettings = [AerServNativeAdRendererSettings new];
asNativeSettings.renderingViewClass = [MoPubCell class];
asNativeSettings.viewSizeHandler = sizeHandler;
MPNativeAdRendererConfirguration * asNativeRenderConfig = [AerServNativeAdRenderer rendererConfigurationWithRendererSettings:asNativeSettings];
NSArray* renderConfigArr = @[asNativeRenderConfig];

 

Advanced Topics

Server Parameters

AerServ server ad parameters must be in JSON format.  Currently we support these parameters:

 

NAME TYPE REQUIRED DEFAULT DESCRIPTION

placement

String

Yes

N/A

AerServ Placement

 

Here is a sample value:

{ 
"placement": "1000731"
}

 

Event Mapping

AerServ banner events are mapped to MoPub's MPAdViewDelegate events, as follows:

-adViewDidLoadAd: -bannerCustomEvent:didLoadAd:

-adViewDidFailToLoadAd:withError:-bannerCustomEvent:didFailToLoadAdWithError:

-willLeaveApplicatonFromAd:-bannerCustomEventWillLeaveApplication:

-adWasClicked:-bannerCustomEventWillBeginAction:

-didDismissModalViewForAd:-bannerCustomEventDidFinishAction:

 

AerServ interstitial events are mapped to MoPub's MPInterstitialAdControllerDelegate events, as follows:

-interstitialViewControllerDidPreloadAd: -interstitialCustomEvent:didLoadAd:

-interstitialViewControllerAdFailedToLoad:withError:-interstitialCustomEvent:didFailToLoadAdWithError:

-interstitialViewControllerWillDisappear: -interstitialCustomEventWillDisappear:

-interstitialViewControllerDidDisappear:-interstitialCustomEventDidDisappear:

-interstitialViewControllerWillAppear:-interstitialCustomEventWillAppear:

-interstitialViewControllerDidAppear:-interstitialCustomEventDidAppear:

-interstitialViewControllerAdWasTouched:-interstitialCustomEventDidReceiveTapEvent:

 

AerServ rewarded video events are mapped to MoPub's MPRewardedVideoAdManagerDelegate events, as follows:

-interstitialViewControllerDidPreloadAd: -rewardedVideoDidLoadAdForCustomEvent:

-interstitialViewControllerAdFailedToLoad:withError:-rewardedVideoDidFailToLoadAdForCustomEvent:error:

-interstitialViewControllerWillDisappear: -rewardedVideoWillDisappearForCustomEvent:

-interstitialViewControllerDidDisappear:-rewardedVideoDidAppearForCustomEvent:

-interstitialViewControllerWillDisappear:-rewardedVideoWillAppearForCustomEvent:

-interstitialViewControllerDidAppear:-rewardedVideoWillAppearForCustomEvent:

-interstitialViewControllerAdWasTouched:-rewardedVideoDidReceiveTapEventForCustomEvent:

-interstitialViewControllerDidVirtualCurrencyReward:vcData:-rewardedVideoShouldRewardUserForCustomEvent:reward:

  

AerServ native static events are mapped to MoPub’s MPNativeCustomEventDelegate events, as follows:

-nativeAd:didFailToLoadWithError: -nativeCustomEvent:didFailToLoadAdWithError:

-nativeAdDidPreload:-nativeCustomEvent:didLoadAd:

  

  

Dynamic Bidding

To enable dynamic bidding, you will need to do 2 things:

  • Set up the line item to use the specific keywords with pricing (see below section)  and implement the new AerServ bidder class.
  • Update your existing MoPub implementation. 

 

Line item sample set up for Dynamic Bidding:

Line-Items.png

 

Advanced Targeting sample set up for Dynamic Bidding:

Advanced-Targeting.png

 

 
Please Note: Be sure to substitute the text "PLC" located after "AS_" with your actual PLC ID #.

 

Please use this as a guideline for eCPM/Keywords:

Video Price Points: 

eCPM Keyword   eCPM  Keyword
 0.50  AS_PLC:0.50    9.50  AS_PLC:9.50
 1.00  AS_PLC:1.00    10.00  AS_PLC:10.00 
 1.50  AS_PLC:1.50    11.00   AS_PLC:11.00
 2.00  AS_PLC:2.00    12.00   AS_PLC:12.00
 2.50  AS_PLC:2.50    13.00   AS_PLC:13.00
 3.00  AS_PLC:3.00    14.00   AS_PLC:14.00
 3.50  AS_PLC:3.50    15.00   AS_PLC:15.00
 4.00  AS_PLC:4.00    16.00   AS_PLC:16.00
 4.50  AS_PLC:4.50    17.00   AS_PLC:17.00
 5.00  AS_PLC:5.00    18.00   AS_PLC:18.00
 5.50  AS_PLC:5.50    19.00   AS_PLC:19.00
 6.00  AS_PLC:6.00    20.00   AS_PLC:20.00
 6.50  AS_PLC:6.50    21.00   AS_PLC:21.00
 7.00  AS_PLC:7.00    22.00   AS_PLC:22.00
 7.50  AS_PLC:7.50    23.00   AS_PLC:23.00
 8.00  AS_PLC:8.00    24.00   AS_PLC:24.00
 8.50  AS_PLC:8.50    25.00   AS_PLC:25.00
 9.00 AS_PLC:9.00      

 

Banner Price Points: 

eCPM Keyword   eCPM  Keyword
 0.25  AS_PLC:0.25    3.50  AS_PLC:3.50
 0.50  AS_PLC:0.50    3.75  AS_PLC:3.75
 0.75  AS_PLC:0.75    4.00   AS_PLC:4.00
 1.00  AS_PLC:1.00    4.25   AS_PLC:4.25
 1.25  AS_PLC:1.25    4.50   AS_PLC:4.50
 1.50  AS_PLC:1.50    4.75   AS_PLC:4.75
 1.75  AS_PLC:1.75    5.00   AS_PLC:5.00
 2.00  AS_PLC:2.00    6.00   AS_PLC:6.00
 2.25  AS_PLC:2.25    7.00   AS_PLC:7.00
 2.50  AS_PLC:2.50    8.00    AS_PLC:8.00
 2.75  AS_PLC:2.75    9.00   AS_PLC:9.00
 3.00  AS_PLC:3.00    10.00   AS_PLC:10.00
 3.25  AS_PLC:3.25      

 

 

 

Technical Integration details for Dynamic Bidding: 

 
Please Note:  Make sure that your implementation uses MoPub's init SDK method if you are using a version of MoPub that supports it.

 

 

You can consult their docs here for more information:  https://developers.mopub.com/docs/ios/initialization/

 

 
MPMoPubConfiguration *sdkConfig = [[MPMoPubConfiguration alloc] initWithAdUnitIdForAppInitialization:@"AD_UNIT_ID"];
[[MoPub sharedInstance] initializeSdkWithConfiguration:sdkConfig completion:nil]
        

If you are updating your IOS SDK version from a prior version, ensure that you've updated all of these files. These plugin files are available in the network-support / MoPub folder. Otherwise, if this is your first time integrating, just ensure that you include these files in your project. 

  • AerServBidListener.h
  • AerServBidObject.h
  • AerServBidObject.m
  • AerServBidder.h
  • AerServBidder.m
  • AerServCustomEventBanner.m
  • AerServCustomEventInterstitial.m
  • AerServCustomEventRewardedInterstitial.m

 

Import AerServBidListener and AerServBidder:

#import "AerServBidListener.h"
#import "AerServBidder.h"

 

Make a new AerServBidder:

AerServBidder* aerservBidder = [AerServBidder getSharedBidder];

 

The AerSerBidder will allow you to update a 'bid' with a price. The updateBidPrice functions will take in an AerServ placement (replace <PLC> with your AerServ placement) as one of the parameters.

You must also implement AerServBidListenerDelegate and implement the delegate functions. The AerServBidListener has 2 delegate functions that need to be implemented:  bidReceived, and bidFailedToLoad. You want to call the appropriate loadAd function here based off of the type of Ad returned.

When you get bidReceived, you may be returned a MPAdView for banner or MPInterstitialAdController for interstitial.

In the case for rewarded, you are returned a NSString of keywords which you then use to call loadRewardedVideoAdWithAdUnitID

Below, we've provided examples for Banner, Interstitial, and Rewarded, as well as a sample delegate implementation that will handle all 3 cases.

 
Please Note: Replace MPUNIT with your MoPub Ad unit and PLC with your AerServ placement

 

Banner Example:


self.adViewBanner = [MPAdView alloc initWithAdUnitId:MPUNIT size:MOPUB_BANNER_SIZE];
AerServBidder* aerservBidder = [AerServBidder getSharedBidder];
[aerservBidder updateBidPriceForBanner:PLC mopubBanner:self.adViewBanner aerservBidListener:self];
        

Remeber to then add the banner to the view and call show on it once you get the bidReceived delegate callback. You can reference the section below as well to see an example implementation. For more information about MoPub banner implementation, you can consult the relevant MoPub documentation here: https://developers.mopub.com/docs/ios/banner/ 

 

Interstitial Example:


self.interstitial = MPInterstitialAdController interstitialAdControllerForAdUnitId:MPUNIT;
AerServBidder* aerservBidder = [AerServBidder getSharedBidder];
[aerservBidder updateBidPriceForInterstitial:PLC mopubInterstitial:self.interstitial aerservBidListener:self]
            

Remember to then call show on the interstitial once you get the bidReceived delegate callback. You can reference the section below as well to see an example. For more information about MoPub interstitial implementation, you can consult the relevant MoPub documentation here: https://developers.mopub.com/docs/ios/interstitial/ 

 

Rewarded Example: 


AerServBidder* aerservBidder = [AerServBidder getSharedBidder];
[aerservBidder updateBidPriceForRewarded:@PLC aerservBidListener:self];
            

You can reference the section below as well to see an example. For more information about MoPub rewarded implementation, you can consult the relevant MoPub documentation here: https://developers.mopub.com/docs/ios/rewarded-video/

 

 

 

Banner / Interstitial Delegate implementation example:


// If we made a banner or interstitial request
- (void)bidReceived: (id) mpObject {
    
    // If the mpObject is a banner:
    if([mpObject isKindOfClass:MPAdView class]) { 
        MPAdView* mpAdView = (MPAdView*)mpObject; 
        mpAdView.delegate = self; 
        [self.bannerView addSubview:mpAdView]; 
        [mpAdView loadAd]; 
    }

    // If the mpObject is an interstitial:
    if([mpObject isKindOfClass:MPInterstitialAdController class]) {
        MPInterstitialAdController* mpInterstitialController = (MPInterstitialAdController*) mpObject; 
        mpInterstitialController.delegate = self; 
        [mpInterstitialController loadAd]; 
    }
}

 // If for any reason, the bid failed to work for banner/interstitial
 - (void)bidFailedToLoad: (id) mpObject error:(NSError *)error {}    

            

Rewarded Delegate implementation example:


// If we made a rewarded video request
- (void)bidReceived: (NSString *) mpKeywords{
    NSString* keywords = mpKeywords;
    [MPRewardedVideo loadRewardedVideoAdWithAdUnitID:PUB_ID_REWARDED keywords:keywords userDataKeywords:nil location:nil customerId:nil mediationSettings:@[]];
}
                
// If for any reason, the bid failed to work for rewarded
-(void)bidFailedToLoad: (NSString *) mpKeywords error:(NSError *)error{}


            

 

 

 

Step 1: Download Android SDK and Required Adapter Files

Download latest AerServ Android SDK here. The downloaded ZIP file contains both the SDK library and adapter files.

 

Step 2: Configure Your Project

  1. Follow MoPub's instructions on setting up their SDK for your project.
  2. Unzip AerServ SDK ZIP file, and copy aerserv-android-sdk/lib/aerserv-sdk.jar into your project's libs folder.
  3. Copy all Java files from aerserv-android-sdk/network-support/MoPub into your project's source folder. These adapter files have com.mopub.mobileads as package name. You can either put them in the corresponding destination folder, or you can change the package name at the top of each adapter file.
  4. Add the following...
    • Permissions AndroidManifest.xml: 
      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
      <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
      <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    • Activities AndroidManifest.xml:
      
      <activity
             android:name="com.aerserv.sdk.view.AerServFullScreenAdActivity"
             android:theme="@android:style/Theme.Translucent"
             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
              
      <activity
             android:name="com.aerserv.sdk.view.ASVastInterstitialActivity"
             android:theme="@android:style/Theme.Translucent"
             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
              
      <activity 
             android:name="com.aerserv.sdk.view.ASWebviewInterstitialActivity" 
             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
              
      <activity 
             android:name="com.aerserv.sdk.view.ASVpaidInterstitalActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" 
             android:hardwareAccelerated="true" />
  5. You must initialize our SDK.  We recommend that you invoke this initialization routine at least 10 seconds before you intend to show your first ad (a good location would be your main activity's onCreate() method).

     

    • To initialize the SDK, invoke the following:
    AerServSdk.init(MainActivity.this, MY_APP_ID);
    • How to obtain the app ID:
      1. Log on to the AerServ platform.
      2. Go to the 'Inventory' tab in the top navigation bar.
      3. Click the 'Edit' icon next to the app whose ID you wish to obtain.
      4. You will find the app ID at the very top of the page.
  6. To set or update the General Data Protection Regulation (GDPR) user consent flag, call AerServSDK’s setGdprConsentFlag method. Pass true for user consent if GDPR user consent was granted and false if user consent was denied or if unknown. To have the GDPR user consent flag be set prior to an ad request, call the setGdprConsentFlag method before requesting an ad. The value passed into setGdprConsentFlag will persist as a private value within Android’s SharedPreferences. Thus, it is not necessary to reset the user consent value prior to each ad request; the value set is applicable for all subsequent requests until that value is reset.

    AerServSdk.setGdprConsentFlag((Activity) MY_ACTIVITY, (boolean) true);

 

Step 3: Configure Ad Settings on AerServ Web Interface

    1. Follow instruction to set up AerServ Placements and Ad Sources.
    2. For banner ads, please set refresh interval to Never. If you want banner refresh, enable it with MoPub instead.
 
Important Note: If you want to enable banner refresh, you should only do so with one SDK. Having refresh on both SDKs will result in duplicate requests. We recommend that you enable it for MoPub and disable it for AerServ.

 

Step 4: Configure Ad Settings on MoPub Web Interface

    1. (Optional) Create a new AdUnit with the ad type that you'll like to use AerServ with. You can use a existing AdUnit if one already exist.
    2. Now go to the 'Orders' tab and click on Create order. Creating a new 'Order' is optional. You can use a existing order if one already exist. If you decide to use a exist order, you will need to create a new Line Item instead.
    3. When creating a new Order/Line Item, use the following parameters:
      • Advertiser: AerServ
      • Type & Priority: Network
      • Network: Custom Native Network
      • Class: Use one of the following class names. If you changed the package name please change the classpath to correspond with the new package name.
        • For Banner: com.mopub.mobileads.AerServCustomEventBanner
        • For Interstitial: com.mopub.mobileads.AerServCustomEventInterstitial
        • For Rewarded Video: com.mopub.mobileads.AerServCustomEventRewardedInterstitial
      • eCPM: You will need to the eCPM from the AerServ dashboard. If you have any question please contact our support.
      • Data: AerServ ad parameters, in JSON format. This field will take any additional parameter for the AerServ SDK. Refer to Advanced Topics > Server Parameters for more information.
      • Ad Unit: Select the newly created AdUnit created or use existing a AdUnit.

 

Step 5: Request Ads

Follow MoPub instructions to request banner or interstitial, but using ad units that you created in Step 3 above. There are no different or special API calls to fetch AerMarket ads, as all mediation is done automatically for you by the adapters.

 

 
Please Note: The AerServ banner impression is dependent on the MoPubView being added onto the UI. Discrepancies may occur in reporting if you fail to attach the MoPubView.

 

Advanced Topics

Server Parameters

AerServ server ad parameters must be in JSON format.  Currently we support these parameters:

 

NAME TYPE REQUIRED DEFAULT DESCRIPTION

placement

String

Yes

N/A

AerServ Placement

 

Here is a sample value:

{ 
"placement": "1000731"
}

 

 

Event Mapping

AerServ banner events are mapped to MoPub's CustomEventBanner events, as follows:

AD_LOADED onBannerLoaded()

AD_FAILEDonBannerFailed()

AD_CLICKEDonBannerClicked()

 

AerServ interstitial events are mapped to MoPub's CustomEventInterstitial events, as follows:

PRELOAD_READYonInterstitialLoaded()

AD_FAILEDonInterstitialFailed()

AD_IMPRESSION onInterstitialShown()

AD_CLICKEDonInterstitialClicked()

AD_DISMISSEDonInterstitialDismissed()

 

AerServ rewarded video events are mapped to MoPub's CustomEventRewardedVideo events, as follows:

PRELOAD_READYonRewardedVideoLoadSuccess()

AD_FAILEDonRewardedVideoLoadFailure()

VIDEO_START onRewardedVideoStarted()

AD_CLICKEDonRewardedVideoClicked()

AD_DISMISSEDonRewardedVideoClosed()

VC_REWARDED → onRewardedVideoCompleted()

 

 

Error Codes

AerServ adapter will fire the following MoPub errors using their AdRequest error enum:

 

ADREQUEST ENUM CONDITION

NETWORK_NO_FILL

AerServ SDK fired AD_FAILED event. See AerServ SDK documentation for more details.

  

  

Dynamic Bidding

 

 
Please Note: Contact your assigned account manager to get more information regarding what dynamic bidding is, and how it can help you!

 

To enable dynamic bidding functionality in your existing application that integrates with AerServ, you will need to do 2 things:

  • Set up the line item to use the specific keywords with pricing (see below section with images)  
  • Update your existing code to implement the new AerServ bidder class.

 

 

 

Line item sample set up for Dynamic Bidding:

Line-Items.png

 

Advanced Targeting sample set up for Dynamic Bidding:

Advanced-Targeting.png

 

 
Please Note: Be sure to substitute the text "PLC" located after "AS_" with your actual PLC ID #.

 

Please use this as a guideline for eCPM/Keywords:

Video Price Points: 

eCPM Keyword   eCPM  Keyword
 0.50  AS_PLC:0.50    9.50  AS_PLC:9.50
 1.00  AS_PLC:1.00    10.00  AS_PLC:10.00 
 1.50  AS_PLC:1.50    11.00   AS_PLC:11.00
 2.00  AS_PLC:2.00    12.00   AS_PLC:12.00
 2.50  AS_PLC:2.50    13.00   AS_PLC:13.00
 3.00  AS_PLC:3.00    14.00   AS_PLC:14.00
 3.50  AS_PLC:3.50    15.00   AS_PLC:15.00
 4.00  AS_PLC:4.00    16.00   AS_PLC:16.00
 4.50  AS_PLC:4.50    17.00   AS_PLC:17.00
 5.00  AS_PLC:5.00    18.00   AS_PLC:18.00
 5.50  AS_PLC:5.50    19.00   AS_PLC:19.00
 6.00  AS_PLC:6.00    20.00   AS_PLC:20.00
 6.50  AS_PLC:6.50    21.00   AS_PLC:21.00
 7.00  AS_PLC:7.00    22.00   AS_PLC:22.00
 7.50  AS_PLC:7.50    23.00   AS_PLC:23.00
 8.00  AS_PLC:8.00    24.00   AS_PLC:24.00
 8.50  AS_PLC:8.50    25.00   AS_PLC:25.00
 9.00 AS_PLC:9.00      

 

Banner Price Points: 

eCPM Keyword   eCPM  Keyword
 0.25  AS_PLC:0.25    3.50  AS_PLC:3.50
 0.50  AS_PLC:0.50    3.75  AS_PLC:3.75
 0.75  AS_PLC:0.75    4.00   AS_PLC:4.00
 1.00  AS_PLC:1.00    4.25   AS_PLC:4.25
 1.25  AS_PLC:1.25    4.50   AS_PLC:4.50
 1.50  AS_PLC:1.50    4.75   AS_PLC:4.75
 1.75  AS_PLC:1.75    5.00   AS_PLC:5.00
 2.00  AS_PLC:2.00    6.00   AS_PLC:6.00
 2.25  AS_PLC:2.25    7.00   AS_PLC:7.00
 2.50  AS_PLC:2.50    8.00    AS_PLC:8.00
 2.75  AS_PLC:2.75    9.00   AS_PLC:9.00
 3.00  AS_PLC:3.00    10.00   AS_PLC:10.00
 3.25  AS_PLC:3.25      

 

 

Technical Integration details for Dynamic Bidding: 

 
Please Note:  Make sure that your implementation uses MoPub's init SDK method if you are using a version of MoPub that supports it.
 

 

You can consult their docs here for more information: https://developers.mopub.com/docs/android/initialization/  

MoPub.initializeSdk(this, sdkConfiguration, initSdkListener());

  

  

If you are updating your Android SDK version from a prior version, ensure that you've updated all of these files. These plugin files are available in the network-support / MoPub folder. Otherwise, if this is your first time integrating, just ensure that you include these files in your project. 

  • AerServBidder.java
  • AerServBidListener.java
  • AerServCustomEventBanner.java
  • AerServCustomEventInterstitial.java
  • AerServCustomEventRewardedInterstitial.java
  • AerServPluginUtil.java

Our recommendation is that you create a new package name like com.mopub.mobileads - you are free to change this as you wish. Just ensure that when you do the below import, that you update the package names.

 

Import AerServBidListener and AerServBidder:

import com.mopub.mobileads.AerServBidListener;
import com.mopub.mobileads.AerServBidder;

 

Make a new AerServBidder:

AerServBidder aerServBidder = AerServBidder.getInstance();

 

The AerSerBidder will allow you to update a 'bid' with a price. It will take in an AerServ placement (replace PLC with your AerServ placement) as one of the key parameters.

The AerServBidListener defines 2 callbacks: onBidRecieved, and onBidFailed.

When you get onBidRecieved, you are returned a mopubObject which you can then cast to MoPubView, and call the relevant method to display the ad. 

Below, we've provided examples for Banner, Interstitial, and Rewarded:

 
Please Note: Replace MPUNIT with your MoPub Ad unit and PLC with your AerServ placement

 

Banner Example:


aerServBidder.updateBidForBanner(PLC, this, mMopubBannerView, new AerServBidListener() {

@Override
public void onBidRecieved(Object mopubObject){ 
    MoPubView moPubBanner = (MoPubView) mopubObject; 
    mMopubBannerView.loadAd();
}

@Override
public void onBidFailed(Object mopubObject, Error error) {}

});
            

For more information about MoPub banner implementation, you can consult the relevant MoPub documentation here: https://developers.mopub.com/docs/android/banner/ 

 

Interstitial Example:


aerServBidder.updateBidForInterstitial(PLC, this, mMopubInterstitialView, new AerServBidListener() {
    
@Override 
public void onBidRecieved(Object mopubObject){  
    MoPubInterstitial moPubInterstitial = (MoPubInterstitial) mopubObject;  
    moPubInterstitial.load(); 
}

@Override
public void onBidFailed(Object mopubObject,Error error) {}

});
        

Remember to then show the interstitial. Consult MoPub documentation here regarding interstitials: https://developers.mopub.com/docs/android/interstitial/ 


public void onInterstitialLoaded(MoPubInterstitial interstitial) {
    if (mMopubInterstitialView.isReady(){  
        mMopubInterstitialView.show();  
    }
}
        

 

Rewarded Example: 


aerServBidder.updateBidForRewarded(PLC, this, new AerServBidListener() {
    
@Override 
public void onBidRecieved(Object mopubObject) { 
    if (mopubObject != null) {   
        MoPubRewardedVideoManager.RequestParameters requestParameters = (MoPubRewardedVideoManager.RequestParameters) mopubObject;   
        MoPubRewardedVideos.loadRewardedVideo( MPUNIT, requestParameters);  
    } 
}
        
@Override 
public void onBidFailed(Object mopubObject, Error error) {}

});
            

Remember to then show the rewarded video. Replace MPUNIT with your MoPub Ad unit.

Consult MoPub documentation here regarding rewarded: https://developers.mopub.com/docs/android/rewarded-video/


public void onRewardedVideoLoadSuccess(String adUnitId){
    MoPubRewardedVideos.showRewardedVideo(MPUNIT);
}

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments