Mediating AdTiming

Follow

Mediating AdTiming through Admob (Interstitial/ Video supported only)

This guide is for integrating AdTiming Interstitial & Rewarded Video Ads through the AdMob Mediation SDK. 
 
1. Add your new app and set up the ad placement of Interstitial or Video through AdMob platform
 
2. Create custom events for the ad placement of Interstitial or Video through AdMob platform. Refer to the custom events here.
 
3. Configuration information for custom events:

mceclip0.png

■ Class Name: Required field. It is the name of the Implementation Class of AdMob custom event interface. No blanks are allowed at the beginning or at the end.

• The implementation Class of Interface for Interstitial:

com.aiming.mdt.plugin.admob.InterstitialAdapter

• The implementation Class of Interface for Video:

com.aiming.mdt.plugin.admob.VideoAdapter

■ Parameter:Required field. The Parameter passed to the interface implementation class.

Format: "appkey" + "_" + "placementId"

Note that no blanks are allowed at the beginning or at the end, or in the middle.

4. Refer to the Admob official documents for InterstitialAd and RewardedVideoAd:

 

Mediating AdTiming through Mopub (Native, Interstitial, video supported only) 

1. Add your new app and set up the ad placement of Native, Interstitial or video through Mopub platform
 
2. Navigate to Neworks → Custom Network → choose the SDK Network Type
 

Image text


Image text


Image text

3. Description of the settings for Custom Network

■ Custom Event class: Required field. It is the Implementation Class of Mopub Adapter.

• Interstitial: com.mopub.mobileads.AdtInterstitial
• Video: com.mopub.mobileads.AdtVideo
• Native: com.mopub.nativeads.AdtNative
■ Custom Event class Data: Required field. The Parameter passed to the Adapter.

• JSON-formatted String: {"app_key":"","placement_id":""}

4. Set up Segments, enable Segments, while disabled by default

Image text

5. Refer to the Mopub official documents for InterstitialAd and RewardedVideoAd: official website → The section of Interstitial and Rewarded Video
 
6. The call of Mopub Adapter(Native): Please refer to the case of Mopub Native Invocation:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<ImageView android:id="@+id/privacy_information_icon_image"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
/>

<!—Ads Title Optional -->
<TextView android:id="@+id/native_ad_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="title"
android:layout_below="@+id/privacy_information_icon_image"
/>

<—Ads icon Optional -->
<com.aiming.mdt.nativead.AdIconView
android:id="@+id/iconMediaView"
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_below="@+id/native_ad_title"
android:layout_centerHorizontal="true">

  <ImageView android:id="@+id/native_ad_icon_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
/>
</com.aiming.mdt.nativead.AdIconView>

<!—Ads content Optional -->
<TextView android:id="@+id/native_ad_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iconMediaView"
android:layout_centerHorizontal="true"
android:text="text"
/>

<!—Large Graph for Ads Optional -->
<com.aiming.mdt.nativead.MediaView
android:id="@+id/mediaView"
android:layout_width="250dp"
android:layout_height="175dp"
android:layout_below="@+id/native_ad_text"
android:layout_centerHorizontal="true" >
<ImageView android:id="@+id/native_ad_main_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
/>
</com.aiming.mdt.nativead.MediaView>
<!—Button for Ads Optional -->
<Button
android:id="@+id/ad_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:text="btn"
android:textAllCaps="false"
android:layout_below="@+id/mediaView"
android:layout_centerHorizontal="true"
/>
</RelativeLayout>

 import com.mopub.nativeads.AdtMoPubStaticNativeAdRenderer;
 import com.mopub.nativeads.AdtViewBinder;
 import com.mopub.nativeads.MoPubNative;
 import com.mopub.nativeads.NativeAd;
 import com.mopub.nativeads.NativeErrorCode;
 private MoPubNative moPubNative;
 private RelativeLayout adParent;
  //Load the ad
 public void loadNativeAd(View view) {  
     adParent.removeAllViews();
     mNativeAd = null;
     AdtViewBinder viewBinder = new AdtViewBinder.Builder(R.layout.mopub_native_ad_layout)
        .privacyInformationIconImageId(R.id.privacy_information_icon_image)
        .titleId(R.id.native_ad_title)
        .textId(R.id.native_ad_text)
        .iconImageId(R.id.native_ad_icon_image)
        .mainImageId(R.id.native_ad_main_image)
        .callToActionId(R.id.ad_btn)
        .mediaViewId(R.id.mediaView)
        .adIconViewID(R.id.iconMediaView)
        .build();

    moPubStaticNativeAdRenderer = new AdtMoPubStaticNativeAdRenderer(viewBinder, this);
    // The parent container for native ads must be set
    moPubStaticNativeAdRenderer.setAdParent(adParent);
    moPubNative = new MoPubNative(this, adUnitId, this);
    moPubNative.registerAdRenderer(moPubStaticNativeAdRenderer);
    moPubNative.makeRequest();
 }

 //Show the ad
 public void showNativeAd(View view) {
    if (mNativeAd == null) {
        return;
    }

    View adView = moPubStaticNativeAdRenderer.createAdView(this, null);
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
           RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    layoutParams.addRule(Gravity.CENTER);
    adParent.removeAllViews();
    adParent.addView(adView, layoutParams);
    mNativeAd.prepare(adView);
    mNativeAd.renderAdView(adView);
  }

  //Successful callback of native ad loading of Mopub
  @Override
  public void onNativeLoad(NativeAd nativeAd) {

      mNativeAd = nativeAd;
      nativeAd.setMoPubNativeEventListener(new NativeAd.MoPubNativeEventListener() {
             @Override
             public void onImpression(View view) {
                Log.d(TAG, "---onImpression--");
             }

             @Override
             public void onClick(View view) {
                Log.d(TAG, "---onClick--");
             }
       });
   }

   //Failure callback of native ad loading of Mopub
   @Override
   public void onNativeFail(NativeErrorCode errorCode) {
      Log.d(TAG, "---onNativeFail--" + errorCode.toString());
   }

 

1 out of 1 found this helpful

Comments

0 comments

Please sign in to leave a comment.