adPOPcorn DA
adPOPcorn DA(Display Ad) is the monetized solution that involves banner, interstitial, ending, 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: Unity Android]
Unity Android
This will guide you through adding IGAWorks DA plugin package to an Unity Android Project.
Add Package
Downloaded from [SDK Download Center], Add the newest IgaworksDisplayAdUnityPlugin_aos~* file to the Unity project.
+ If you use adPOPcorn or adbrix ahead, you have to keep IgawCommon_v0.0.0a.jar to be up-to-date.
After adding successfully, you will be able to see the package at 'Asset' folder.
AndroidManifest.xml
Edit AndroidManifest file to integrate adPOPcorn.
In integration, add required activity right after app key, hash key, and permission.
Add required activity at <application></application> tag.
<!-- IGAWorks DA initial request SDK ver : 8 -->
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" />
<!-- Add required DA activity\ -->
<activity android:name="com.igaworks.displayad.activity.InterstitialActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar" />
<!-- Basic Information -->
<meta-data android:name="igaworks_app_key" android:value="IGAWorks App key"/>
<meta-data android:name="igaworks_hash_key" android:value="IGAWorks Hash key"/>
<meta-data android:name="igaworks_market_info" android:value="google"/>
</application>
</manifest>
+ Please take a look at each network’s guide if you want to use the mediation feature that shows different DA network ad.
adPOPcorn DA General Integration
adPOPcorn DA offers banners, interstitial, partial 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.
void Start (){
Debug.Log ("Start");
IgawDisplayAdPlugin.init();
}
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..
void OnDestroy(){
Debug.Log ("OnDestroy");
IgawDisplayAdPlugin.destroy();
}
+ You have to go through disabling delegate inside of OnDestroy() if you have added any before.
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)
IgawDisplayAdPlugin.setSensorLandscaple(true);
Banner Ad
Banner is very general type of DA ad that shows up on either top or bottom.
Create Instance
Create the instance to expose the ad.
public class IgawDASampleScene : MonoBehaviour{
private string BANNER_SPOTKEY = "bannerspotkey";
private Banner bannerAd = null;
void Start(){
bannerAd = new Banner(BANNER_SPOTKEY, Banner.GRAVITY_BOTTOM);
}
}
+ Banner Ad Spotkey: Spotkey created at an adPOPcorn DA management page.
Ad Management
Call this API when you need to manage the banner ad.
//Expose banner ad
void SomeAction(){
if(bannerAd != null)
bannerAd.startBannerAd();
}
//Pause banner ad
void SomeAction(){
if(bannerAd != null)
bannerAd.pauseBannerAd();
}
//Stop banner ad
void SomeAction(){
if(bannerAd != null)
bannerAd.stopBannerAd();
}
Delegate
Creates delegate for the occurring event from banner ad. These are the examples.
- OnBannerAdReceiveSuccess : Banner Ad Load Succeed.
- OnBannerAdReceiveFailed : Banner Ad Load Failed(Check the table below for error code).
//Add banner delegate
void SomeAction(){
if(bannerAd != null)
bannerAd.OnBannerAdReceiveSuccess += OnBannerAdReceiveSuccess;
bannerAd.OnBannerAdReceiveFailed += OnBannerAdReceiveFailed;
}
//Materialize banner delegate
public void OnBannerAdReceiveSuccess(object sender, System.EventArgs args){
Debug.Log("OnBannerAdReceiveSuccess event received.");
}
public void OnBannerAdReceiveFailed(object sender, ErrorResult errorResult){
Debug.Log("OnBannerAdReceiveFailed event received. > errorCode : " +
errorResult.errorCode + ", errorMessage : " + errorResult.errorMessage);
}
//Release banner delegate
void OnDestroy(){
if (bannerAd != null) {
bannerAd.OnBannerAdReceiveSuccess -= OnBannerAdReceiveSuccess;
bannerAd.OnBannerAdReceiveFailed -= OnBannerAdReceiveFailed;
bannerAd.stopBannerAd ();
}
IgawDisplayAdPlugin.destroy ();
}
Interstitial Ad
Interstitial ad covers the entire screen for ad. Check the following example for integration.
Create Instance
Create the instance for Interstitial ad.
public class IgawDASampleScene : MonoBehaviour{
private string INTERSTITIAL_SPOTKEY = "interstitialspotkey";
private Interstitial interstitialAd = null;
void Start(){
interstitialAd = new Interstitial(INTERSTITIAL_SPOTKEY);
}
}
+ Interstitial ad spotkey: Spotkey created at an AdPOPcorn DA management page.
Ad Management
Call this API when you need to manage the interstitial ad.
//Expose interstial ad
void SomeAction(){
if(interstitialAd != null)
interstitialAd.showInterstitialAd();
}
Delegate
Creates delegate for the occurring event from interstitial ad. These are the examples.
- OnInterstitialReceiveSuccess : interstitial Ad Load Succeed.
- OnInterstitialReceiveFailed : interstitial Ad Load Failed(Check the table below for error code).
- OnInterstitialClosed : interstitial ad window closed.
//Add interstitial delegate
void SomeAction(){
if(interstitialAd != null)
interstitialAd.OnInterstitialReceiveSuccess += OnInterstitialReceiveSuccess;
interstitialAd.OnInterstitialReceiveFailed += OnInterstitialReceiveFailed;
interstitialAd.OnInterstitialClosed += OnInterstitialClosed;
}
//Materialize interstitial delegate
public void OnInterstitialReceiveSuccess(object sender, System.EventArgs args){
Debug.Log("OnInterstitialReceiveSuccess event received.");
}
public void OnInterstitialReceiveFailed(object sender, ErrorResult errorResult){
Debug.Log("OnInterstitialReceiveFailed event received. > errorCode : " +
errorResult.errorCode + ", errorMessage : " + errorResult.errorMessage);
}
public void OnInterstitialClosed(object sender, System.EventArgs args){
Debug.Log("OnInterstitialClosed event received.");
}
//Release interstitial delegate
void OnDestroy(){
if (interstitialAd != null) {
interstitialAd.OnInterstitialReceiveSuccess -= OnInterstitialReceiveSuccess;
interstitialAd.OnInterstitialReceiveFailed -= OnInterstitialReceiveFailed;
interstitialAd.OnInterstitialClosed -= OnInterstitialClosed;
}
IgawDisplayAdPlugin.destroy ();
}
Pop-up Ad
Pop-up ad is the format using partial screen with visible background.
Create Instance
Create the instance to expose pop-up ad.
public class IgawDASampleScene : MonoBehaviour{
private string POPUP_SPOTKEY = "popupspotkey";
private PopupAd popupAd = null;
void Start(){
popupAd = new PopupAd(POPUP_SPOTKEY);
}
}
+ Pop-up ad spotkey: Spotkey created at an AdPOPcorn DA management page.
Ad Management
Call this API when you need to manage the pop-up ad.
//Expose popup delegate
void SomeAction(){
if(popupAd != null)
popupAd.showPopupAd();
}
+ Pop-up ad spotkey: Spotkey created at an AdPOPcorn DA management page.
Delegate
Creates delegate for the occurring event from pop-up ad. These are the examples.
- OnPopupAdReceiveSuccess : Pop-up Ad Load Succeed.
- OnPopupAdReceiveFailed : Pop-up Ad Load Failed(Check the table below for error code).
- OnPopupAdClosed : Pop-up ad window closed.
//Add popup delegate
Void SomeAction(){
if (popupAd != null){
popupAd.OnPopupAdReceiveSuccess += OnPopupAdReceiveSuccess;
popupAd.OnPopupAdReceiveFailed += OnPopupAdReceiveFailed;
popupAd.OnPopupAdClosed += OnPopupAdClosed;
}
}
//Materialize popup delegate
public void OnPopupAdReceiveSuccess(object sender, System.EventArgs args){
Debug.Log("OnPopupAdReceiveSuccess event received.");
}
public void OnPopupAdReceiveFailed(object sender, ErrorResult errorResult){
Debug.Log("OnPopupAdReceiveFailed event received. > errorCode : " +
errorResult.errorCode + ", errorMessage : " + errorResult.errorMessage);
}
public void OnPopupAdClosed(object sender, System.EventArgs args){
Debug.Log("OnPopupAdClosed event received.");
}
//Release popup delegate
void OnDestroy(){
if (popupAd != null) {
popupAd.OnPopupAdReceiveSuccess -= OnPopupAdReceiveSuccess;
popupAd.OnPopupAdReceiveFailed -= OnPopupAdReceiveFailed;
popupAd.OnPopupAdClosed -= OnPopupAdClosed;
}
IgawDisplayAdPlugin.destroy ();
}
Ending Ad
Ending ad shows up as the app asks for closing the app event.
Create Instance and Load Ad
Create the instance to expose the ending ad. Use loadEndingAd API to load ending ad. It must be called as the app starts to load the ad information in the beginning.
public class IgawDASampleScene : MonoBehaviour{
private string ENDING_SPOTKEY = "endingspotkey";
void Start(){
IgawDisplayAdPlugin.loadEndingAd(ENDING_SPOTKEY);
}
}
+ Ending ad spotkey: Spotkey created at an AdPOPcorn DA management page.
Ad Exposure
Call showEndingAd API to expose the ad. We encourage to connect at Android's back button event or any closing event.
void Update (){
if (Input.GetKeyDown (KeyCode.Escape)) {
IgawDisplayAdPlugin.showEndingAd(ENDING_SPOTKEY);
}
}
Delegate
If you want to directly control closing action, you can do it by adding and using delegate. These are the examples.
(However, plugin's closing logic won't work if you use delegate.)
void Start (){
// Set Delegate
IgawDisplayAdPlugin.setEndingAdEventCallbackListener(ENDING_SPOTKEY);
IgawDisplayAdPlugin.OnBtnClickListener = mOnBtnClickListener;
}
// implement Delegate
// finish = true : Click close button
// finish = false : Click cancel button
public void mOnBtnClickListener(bool finish){
Debug.Log("mOnBtnClickListener event received : " + finish);
}
Native Ad
Native Ad uses Jason type ad information from adPOPcorn DA server to expose the ad in any type you want.
Create Instance
Create instance to expose the native ad.
- OnNativeAdRequestSucceeded : Native ad load succeed. Returns the native ad information.
- OnNativeAdRequestFailed : Native ad load failed(Check the table below for error code)..
public class IgawDASampleScene : MonoBehaviour{
private string NATIVE_SPOTKEY = "nativespotkey";
private NativeAd nativeAd = null;
void Start(){
nativeAd = new NativeAd(NATIVE_SPOTKEY);
nativeAd.OnNativeAdRequestSucceeded += OnNativeAdRequestSucceeded;
nativeAd.OnNativeAdRequestFailed += OnNativeAdRequestFailed;
}
}
+ Native ad spotkey: Spotkey created at an AdPOPcorn DA management page.
Ad Load
Call loadAd API to load the native ad information. You can see the result by using NativeAd delegate.
void loadNativeAdInfo(){
if (nativeAd != null) {
nativeAd.loadAd();
}
}
Ad Tracking
Since native ad directly controls its exposure, you have to integrate ad exposure and click tracking. These are the examples.
void showNativeAdToUser(){
// Call below formula to track NativeAd impression.
nativeAd.impressionAction();
}
void clickNativeAd(){
// Call below formula to track NativeAd Click.
nativeAd.clickAction();
}
Delegate
The result of native ad information loading will be sent to delegate. These are the examples of delegate.
public void OnNativeAdRequestSucceeded(object sender, NativeAdModel nativeModel){
}
public void OnNativeAdRequestFailed(object sender, ErrorResult errorResult){
Debug.Log("OnNativeAdRequestFailed event received. > errorCode : " +
errorResult.errorCode + ", errorMessage : " + errorResult.errorMessage);
}
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)]