Upgrading from Namo Media SDK Version 1 to Version 2
On both iOS and Android, Namo Media has added some big functional improvements in our version 2 SDKs. With the v2 SDKs you can control the frequency and positioning of ads from the server with our Ad Pacing UI without updating your app. The SDKs also improve the display of ads in your app’s stream by adjusting the ad text to fit your format, and in Android, support manually placing native ads in your app without using the Namo list adapter.
As part of these changes, some of our method definitions have also changed. In this post, we’ll take you through the process of upgrading from a v1 series SDK to v2.
If you’re interested in integrating Namo Media into a new app starting with version 2, you should read our Getting Started Guides for iOS and Android.
Adaptive Text & New Image Loader Methods
SDK 2 changes the methods used for showing ad text in your ad cell and for loading ad images. If you are using a custom ad cell, you will need to make the following changes:
Your existing setAdData method may look like:
- (void)setAdData:(NAMOAdData *)adData { self.adTextLabel.text = adData.text; self.adTitleLabel.text = adData.title; self.advertiserNameLabel.text = adData.advertiserName; [self.adImageView namo_bindAdImage:adData]; [self.iconImageView namo_bindAdIcon:adData]; }
The equivalent code in SDK 2 looks like:
- (void)setAdData:(NAMOAdData *)adData { [adData loadAdTextIntoLabel:self.adTextLabel]; [adData loadAdImageIntoImageView:self.adImageView]; [adData loadAdvertiserNameIntoLabel:self.advertiserNameLabel]; [adData loadAdvertiserIconIntoImageView:self.iconImageView]; }
Ad Pacing & Continuous Scroll Support
Namo Media SDK 2 removes the ad pacing settings from the SDK and replaces them with server-side controls, as described in our recent blog post and pictured here:
Remove all calls to these methods from your application:
NamoAdPlacer -(void)setAdPlacementWithFirstPosition:spacing:maxAds: -(void)setAdPlacementForSection:firstPosition:spacing:maxAds:
You only need to call [adPlacer requestAds] once when you load the stream. The Namo Media SDK will handle requesting more ads when you add content to your data source.
See the Namo Media iOS documentation for a full list of replaced methods.
The v2 SDKs also support Test Mode, which is useful when you’re developing. You will see placeholder ads and will never experience frequency capping or other server-side features that we use to keep impression quality high.
To enable test mode, call this code right after setting the app ID in your initialization of the Namo SDK:
#import <AdSupport/AdSupport.h> ... NSString *testId = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]; [Namo setTestDevices:[NSArray arrayWithObjects:testId, nil] includeSimulator:YES];
Remember to remove these calls before submitting an update to the App Store!
Upgrading the Android SDK
Adaptive Text & New Image Loader Methods
For manual ad creation, we’ve changed the methods on NamoAdData used for showing ad text in your AdViewBinder. The new methods will measure your TextView and load ads with the appropriate sized text.
You will need to change calls to adData.getText() into adData.loadText().into(textView).
For example, if you have code like this:
@Override public void bindAdData(View view, NamoAdData adData) { viewHolder.textView.setText(adData.getText()); ... }
The equivalent code in SDK 2 looks like:
@Override public void bindAdData(View view, NamoAdData adData) { adData.loadText().into(viewHolder.textView); ... }
Ad Pacing & Continuous Scroll Support
Namo Media SDK 2 removes the ad pacing settings from the SDK and replaces them with server-side controls, as described in our recent blog post and pictured here:
Remove all calls to these methods from your application:
NamoListAdapter#setAdPlacement(position, spacing, maxAds);
After integrating SDK 2, you will be able to adjust the frequency and first position of ads in your app immediately from the dashboard. Visit (https://dashboard.namomedia.com/monetize/apps) to select your app and modify the spacing of ads in your app’s feed.
Select your app from the list, then click “Edit.” As you scroll down the page you’ll see a section called “Ad Pacing” where you can control the position and frequency of ads.
When developing with the Namo Media SDK, you should use Test Mode in the simulator and on your development devices. Test Mode signals our servers to not charge for actions on your ads, and will ensure that we always show ads in your stream. You can enable test mode by calling
Namo.setTestDevices(/* includeEmulator */ true, myAndroidId1);
after initializing the SDK.
The Namo Media version 2 SDKs give app developers higher quality ad display and more control over ad placement than ever before. Soon, we’ll tell you a little more about one of our biggest recent UX improvements: Direct App Store access in your apps.