Important Notes
- 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 AppNexus and disable it for AerServ.
- iOS
- Android
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
- Follow AppNexus’s instructions on setting up their SDK for your project.
- Unzip the downloaded SDK package file and copy the
AerServSDK.framework
found at the pathtarget/aerserv-ios-sdk/lib/
into your Xcode project. - Add both the header and implementation file for
AerServCustomEventBanner
,AerServCustomEventInterstitial
andAerServUtils
into your project. - In the General tab inside your project’s settingl, add the following to Linked Frameworks and Libraries.
- AerServSDK.framework
- WebKit.framework
- libxml2.2.tbd
- Next go to Build Settings and add the following configuration:
- Add the linker flag -ObjC to the "Other Linker Flags" field inside the Linking section.
- Add the directory path to the
AerServSDK.framework
to “Framework Search Paths" inside the Search Paths section; select it as recursive.
- In your AppDelegate, add #import <AerSerSDK/AerSerSDK.h>. Initialize the AerServSDK inside application:didiFinishLaunchingWithOptions.
[AerservSDK initializeWithAppID:@"YOUR APPID"]
-
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
- Follow instruction to set up AerServ Placements and Ad Sources.
- For banner ads, please set refresh interval to Never. If you want banner refresh, enable it with AppNexus instead.
Step 4: Configure Ad Settings on AppNexus Web Interface
- If you have not done so already, follow instructions from AppNexus and add your app and ad units.
- Create a “Custom Mobile Network Bid” with the following information:
- Device Class Name: AerServCustomEventBanner for banner and AerServCustomEventInterstitial for interstitial.
- Network Id: This is equivalent to “placement” on the AerServ Ad network.
- Network Parameter: AerServ ad parameters, in JSON format. This field will take any additional parameter for the AerServ SDK. Refer to Advance Topics - Server Parameters for more information.
Step 5: Configure Ad Settings on AppNexus Web Interface
Follow AppNexus 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.
Advanced Topics
Event Mapping
AerServ banner events are mapped to AppNexus’s CustomEventBannerListener events, as follows:
adViewDidLoadAd → didLoadBannerAd
adViewDidFailToLoadAd → didFailToLoadAd
willPresentModalViewForAd → willPresentAd
willLeaveApplicatonFromAd → willLeaveApplication
adWasClicked → adWasClicked
didDismissModalViewForAd → didCloseAd
AerServ interstitial events are mapped to AppNexus’s CustomEventInterstitialListener events, as follows:
interstitialViewControllerDidPreloadAd → didLoadInterstitialAd
interstitialViewControllerAdFailedToLoad → didFailToLoadAd
interstitialViewControllerDidDisappear → didCloseAd
interstitialViewControllerWillAppear → willPresentAd
interstitialViewControllerDidAppear → didPresentAd
interstitialViewControllerAdWasTouched → adWasClicked
Error Codes
AerServ adapter will fire the following AppNexus errors using their AdRequest error enum:
ADREQUEST ENUM | CONDITION |
---|---|
ANAdResponseInvalidRequest |
|
ANAdResponseUnableToFill |
AerServ SDK fired AD_FAILED event. See AerServ SDK documentation for more details. |
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
- Follow AppNexus's instructions on setting up their SDK for your project.
- Unzip AerServ SDK ZIP file, and copy
aerserv-android-sdk/lib/aerserv-sdk.jar
into your project's libs folder. - Copy all Java files from
aerserv-android-sdk/network-support/AppNexus
into your project's source folder. These adapter files have com.aerserv.appnexus 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. - 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" />
- Add the following 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" />
- 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:
- Log on to the AerServ platform.
- Go to the 'Inventory' tab in the top navigation bar.
- Click the 'Edit' icon next to the app whose ID you wish to obtain.
- You will find the app ID at the very top of the page.
-
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
- Follow instruction to set up AerServ Placements and Ad Sources.
- For banner ads, please set refresh interval to Never. If you want banner refresh, enable it with AppNexus instead.
Step 4: Configure Ad Settings on AppNexus Web Interface
- If you have not done so already, follow instructions from AppNexus and add your app and ad units.
- Create a “Custom Mobile Network Bid” with the following information:
- Device Class Name: com.aerserv.appnexus.AerServCustomEventBanner for banner, com.aerserv.appnexus.AerServCustomEventInterstitial for interstitial.
- Network Id: This is equivalent to “placement” on the AerServ Ad network.
- Network Parameter: AerServ ad parameters, in JSON format. This field will take any additional parameter for the AerServ SDK. Refer to Advanced Topics - Server Parameters of this article for more information.
Step 5: Request Ads
Follow AppNexus 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.
Advanced Topics
Event Mapping
AerServ banner events are mapped to AppNexus's CustomEventBannerListener events, as follows:
AD_FAILED → onAdFailed()
AD_CLICKED → onAdClicked()
AD_LOADED → onAdLoaded()
AD_IMPRESSION → onAdExpanded()
* Note: onAdLoaded() is fired during the ad request for banner due to a issue with the banner sizing.
AerServ interstitial events are mapped to AppNexus's CustomEventInterstitialListener events, as follows:
PRELOAD_READY → onAdLoaded()
AD_FAILED → onAdFailed()
AD_CLICKED → onAdClicked()
AD_IMPRESSION → onAdExpanded()
AD_DISMISSED → onAdCollapsed()
Error Codes
AerServ adapter will fire the following AppNexus errors using their AdRequest error enum:
ADREQUEST ENUM | CONDITION |
---|---|
INVALID_REQUEST |
|
UNABLE_TO_FILL |
AerServ SDK fired AD_FAILED event. See AerServ SDK documentation for more details. |
Limitations:
The AppNexus Plugin has a limitation on rendering AdMob and Millennial Media banner due to one of the checks do for banners and how AppNexus SDK is design. As such, for AdMob and Millennial Media mediation, please do this through AppNexus.
Comments