adPOPcorn DA
adPOPcorn DA(Display Ad) is the monetized solution that involves banners, front and end native ad, pop up.
Using a mediation feature with no additional fee, you can maximize profit.
For more information about the service, check the article below.
NOTE
- IGAW Integration must be set before integration adPOPcorn add-on. [IGAW General Integration: Android]
- IgawDisplayAd~*.jar file must to included in an Android project for adPOPcorn integration. [Install SDK: Android]
AndroidManifest.xml
Edit AndroidManifest file to integrate adPOPcorn.
In integration, add required activity right after app key, hash key, and permission.
Add permission at <application></application> tag.
<activity android:name="com.igaworks.displayad.activity.InterstitialActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar" />
+ Please take a look at each network’s guide if you want to use the mediation feature that shows different DA network ad.
+ Interested in participating as an advertiser?
If you want to start CPI or above ad campaign through adPOPcorn ad network, you need to register Google Install Receiver.
[IGAWorks Google Install Receiver Registration Guide]
adPOPcorn DA General Integration
adPOPcorn DA offers banners, interstitial, \pop up, ending, and native type ads. You have to initialize using general API before integrating.
Initialize SDK
Use init API to initialize SDK by calling from the first
activity as an app loads or activity with DA ad.
IgawDisplayAd.init(MyDisplayAdSampleActivity.this);
+ Use init(Context context, Boolean isTestMode, Boolean detailLog) API to initialize Test mode and log print setting.
Disable Resource
Use destroy API to disable DA related resource(View, Memory) as an application closes.
Call this at onDestroy() of app's closing activity..
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
IgawDisplayAd.destroy();
}
Mediation Switch Period
Use setRefreshTime API to set switch period on each network’s ad when the mediation feature is used.
If you don’t specify, the default value is 60 seconds.
//IgawDisplayAd.setRefressTime(int seconds);
IgawDisplayAd.setRefreshTime(40);
Location Information Setting
Use setLocation API to input location information. If a location targeting ad matchs recorded location, it will show up.
//IgawDisplayAd.setLocation(long latitude, double longitude);
IgawDisplayAd.setLocation(123.456789, 23.456789);
Screen Rotation Lock Release
Call setSensorLandscapeEnable API to lock or unlock screen rotation for interstitial, ending and popup advertising.
Advertising will be rotated according to device mode as you unlock the rotation.
// Unlock screen rotation, if you set as false, it will be locked again.(Default)
IgawDisplayAd.setSensorLandscapeEnable(true);
Banner Ad
Banner is very general type of DA ad that shows up on either top or bottom.
View Setting
Add the view that will show banner ad at Layout.xml file.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:orientation="vertical">
<!-- AdPOPcorn DA View -->
<com.igaworks.displayad.view.BannerContainerView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/banner_container"/>
</LinearLayout>
Ad Exposure
Call startBannerAd API to expose ad. The call happens at specific timing or every activity’s onResume() that exposes ad.
//Generate bannerView
private BannerContainerView bannerView;
bannerView = (BannerContainerView)findViewById(R.id.banner_container);
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
IgawCommon.startSession(MyDisplayAdSampleActivity.this);
// Start banner
IgawDisplayAd.startBannerAd(MyDisplayAdSampleActivity.this, “banneradsoptkey”, bannerView);
}
+ bannerView: com.igaworks.displayad.view.BannerContainerView added to Layout.xml
+ Banner Ad Spotkey: Spotkey created at an AdPOPcorn DA management page.
Pause Ad
Use pauseBannerAd API to pause banner ad. Call this at onPause() at the activity you want to pause.
@Override
protected void onPause() {
super.onPause();
// pause banner
IgawDisplayAd.pauseBannerAd(MainActivity.this, “banneradspotkey”);;
}
Stop Ad Exposure
Use UsestopBannerAd API to stop ad exposure. Call this at onDestroy at the activity.
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
// stop banner
IgawDisplayAd.stopBannerAd(MyDisplayAdSampleActivity.this);
// realease banner and ad resource.
IgawDisplayAd.destroy();
}
Event Listener
Offers event listener coming from banner ad. These are the examples for the feature.
- OnBannerAdReceiveSuccess : Banner Ad Loading Succeed.
- OnBannerAdReceiveFailed : Banner Ad Loading Failed(Check the table below for error code).
IgawDisplayAd.setBannerEventCallbackListener(MyDisplayAdSampleActivity.this, “배너광고스팟키”,
new IBannerEventCallbackListener() {
@Override
public void OnBannerAdReceiveSuccess() {
Log.d("DEBUG", "Complete Loading Banner Ad");
}
@Override
public void OnBannerAdReceiveFailed(DAErrorCode daErrorCode) {
Log.d("DEBUG", "Fail Loading Banner Ad, ResultCode : " + daErrorCode.getErrorCode() + ", ResultMsg : " + daErrorCode.getErrorMessage());
}
});
Interstitial Ad
Interstitial ad covers the entire screen for ad. Check the following example for integration.
Expose Ad
Use showInterstitial API to expose the interstitial ad.
public void showInterstitialAdSample () {
IgawDisplayAd.showInterstitialAd(MyDisplayAdSampleActivity.this, “Interstitial ad spotkey”);
}
+ Interstitial ad spotkey: a interstitial ad spooky created at adPOPcorn DA management page.
Event Listener
Offers event listener coming from interstitial ad. These are the examples for the feature.
- OnInterstitialReceiveSuccess : Interstitial ad loading succeed.
- OnInterstitialReceiveFailed : Interstitial ad loading failed(Check the table below for error code).
- OnInterstitialClosed : close interstitial ad window.
IgawDisplayAd.setInterstitialEventCallbackListener(MyDisplayAdSampleActivity.this, "Interstitial ad spotkey",
new IInterstitialEventCallbackListener() {
@Override
public void OnInterstitialReceiveSuccess() {
Log.d("DEBUG", "Complete Loading Interstitial Ad");
}
@Override
public void OnInterstitialReceiveFailed(DAErrorCode daErrorCode) {
Log.d("DEBUG", "Fail Loading Interstitial Ad, ResultCode : " + daErrorCode.getErrorCode() + ", ResultMsg : " + daErrorCode.getErrorMessage());
}
@Override
public void OnInterstitialClosed() {
Log.d("DEBUG", "Interstitial Ad is closed!");
}
});
Pop-up Ad
Pop-up ad is the format using partial screen with visible background.
Expose Ad
Use showPopupAd API to call and expose pop-up ad.
public void showPopupAdSample () {
IgawDisplayAd.showPopupAd(MyDisplayAdSampleActivity.this, “Popup ad spotkey”);
}
+ pop-up ad spotkey: Spotkey created at an AdPOPcorn DA management page.
Event Listener
Offers event listener coming from pop-up ad. These are the examples for the feature.
- OnPopupAdReceiveSuccess : pop-up ad loading succeed
- OnPopupAdReceiveFailed : pop-up ad Loading Failed(Check the table below for error code).
- OnPopupAdClosed : close pop-up ad window.
IgawDisplayAd.setPopupEventCallbackListener(MyDisplayAdSampleActivity.this, "Popup ad spotkey",
new IPopupEventCallbackListener() {
@Override
public void OnPopupAdReceiveSuccess() {
Log.d("DEBUG", "PopupAdReceiveSuccess()");
}
@Override
public void OnPopupAdReceiveFailed(DAErrorCode daErrorCode) {
Log.d("DEBUG", "OnPopupAdReceiveFailed(), ResultCode : " + daErrorCode.getErrorCode() + ", ResultMsg : " + daErrorCode.getErrorMessage());
}
@Override
public void OnPopupAdClosed() {
Log.d("DEBUG", "OnPopupAdClosed()");
}
});
Ending Ad
Shows an ad as pop-up asking for closing the app.
Load Ad
Use loadEndingAd API to load the ad. It should be called as the app starts so it can prepare loading the ad information.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//initialize DA SDK
IgawDisplayAd.init(MyDisplayAdSampleActivity.this);
//load ending ad
IgawDisplayAd.loadEndingAd(MyDisplayAdSampleActivity.this, "endingadspotkey");
}
+ Ending ad spotkey: Spotkey created at an AdPOPcorn DA management page.
Expose Ad
Use showEndingAd API to expose the ad. We encourage to connect at Android's back button event or any closing event.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
IgawDisplayAd.showEndingAd(MainActivity.this, "endingadspotkey");
return true;
}
return super.onKeyDown(keyCode, event);
}
Event Listener
Offers event listener coming from ending ad. These are the examples for the feature.
- OnBtnClickListener : Button click event, true-click end button.
IgawDisplayAd.setEndingAdEventCallbackListener(MyDisplayAdSampleActivity.this, "endingadspotkey",
new IEndingAdEventCallbackListener() {
@Override
public void OnBtnClickListener(boolean isClicked) {
Log.d("DEBUG", "Ending Btn Clicked :: " + isClicked);
}
});
Native Ad
Native Ad uses Jason type ad information from adPOPcorn DA server to expose the ad in any type you want.
Create Instance & Event Listener
Create instance that loads native ad, and event listener which receives requested information as below.
- OnNativeAdRequestSucceeded : Native ad load succeed, Json string type ad information to nativeAdInfo.
- OnNativeAdRequestFailed : failed to load native ad(Check the table below for error code).
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//initialize DA SDK
IgawDisplayAd.init(MyDisplayAdSampleActivity.this);
//generate native ads instance and event listner
IgawNativeAd nativeAd = new IgawNativeAd(MyDisplayAdSampleActivity.this, "nativeadspotkey",
new IgawNativeAdListener() {
@Override
public void OnNativeAdRequestSucceeded(IgawNativeAd nativeAdInfo) { }
@Override
public void OnNativeAdRequestFailed(IgawNativeAdErrorCode daErrorCode) {
Log.d("DEBUG", "NativeAd Loaing Fail, ResultCode : " + daErrorCode.getErrorCode() + ", ResultMsg : " + daErrorCode.getErrorMessage());
}
});
}
+ Native ad spotkey: Spotkey created at an AdPOPcorn DA management page.
Load Ad
Use loadAd API to load native ad information. This will transfer to event lister created above.
IgawNativeAd nativeAd =
new IgawNativeAd(MyDisplayAdSampleActivity.this, "nativeadspotkey",
new IgawNativeAdListener() {
@Override
public void OnNativeAdRequestSucceeded(IgawNativeAd nativeAdInfo) { }
@Override
public void OnNativeAdRequestFailed(IgawNativeAdErrorCode daErrorCode) {
Log.d("DEBUG", "NativeAd Loaing Fail, ResultCode : " + daErrorCode.getErrorCode() + ", ResultMsg : " + daErrorCode.getErrorMessage());
}
});
//load native ad information
nativeAd.loadAd();
Verify Ad Information
When ad loading using loadAd API is succeed, the information transfers to event listener. With this, ad is being organized and exposed.
Use nativeAdInfo.getNativeAdContents API to extract Json string.
IgawNativeAd nativeAd =
new IgawNativeAd(MyDisplayAdSampleActivity.this, "nativeadspotkey",
new IgawNativeAdListener() {
@Override
public void OnNativeAdRequestSucceeded(IgawNativeAd nativeAdInfo) { }
if(nativeAdInfo != null){
//extract Json String of NativeAd and compose it
String nativeAdContents = nativeAdInfo.getNativeAdContents();
Log.d("DEBUG", "AD INFO JSON STRING :: " + nativeAdContents);
}
@Override
public void OnNativeAdRequestFailed(IgawNativeAdErrorCode daErrorCode) {
Log.d("DEBUG", "NativeAd Loaing Fail, ResultCode : " + daErrorCode.getErrorCode() + ", ResultMsg : " + daErrorCode.getErrorMessage());
}
});
Ad Impression Tracking
Use impressionAction API to track native ad impression.
// When native ad is impressed
// ...do someting...
//track native ad click
nativeAd.impressionAction();
+ nativeAd is the instance of IgawNativeAd type.
Ad Click Tracking
Use clickAction API to track native ad click.
//when user click native ads
// ...do somethisng...
//track native ad click
nativeAd.clickAction(MyDisplayAdSampleActivity.this);
+ nativeAd is the instance of IgawNativeAd type.
Clear Instance
Use destroyAd API to clear native ad instance when the activity involving native ad closes or the ad isn't exposed anymore.
@Override
protected void onDestroy() {
super.onDestroy();
//release native ads instance.
nativeAd.destroyAd();
}
DA Response Error Code Definition
This list shows the definition of each error code coming to each type of ad event listener.
Code | Message | Description |
200 | Exception | General error |
1000 | Invalid Parameter | Wrong parameter |
9999 | Unknown Server Error | Unknown server error |
2000 | Invalid Media Key | Wrong app key |
2030 | Invalid Spot Key | Wrong spot key |
2100 | Empty Campaign | No ad campaign |
2200 | Invalid Third Party Name | Failed to load third party network information |
3200 | Native Spot Does Not Initialized | Native setting reset error |
5000 | Server Timeout | Server time out |
5001 | Load Ad Failed | Failed to load specific network's ad |
5002 | No Ad | Failed to load every network ad |
DA Mediation
To use mediation feature, read the following article to proceed.
[adPOPcorn DA: Android(Mediation)]