Cross Promotion

Before You Start

Before integrating ads unit in your app, you must:

  • In the OpenMediation Publisher UI, create an account, create an app, and create an ad placement using the format 'Cross Promote'. You can follow guides here.
  • Follow our steps to Android SDK Integration by integrating the SDK into your project.
  • If you use mediation, go to Add Mediation Networks and make sure you have added the ad network SDKs and the corresponding adapters you wish to use to your app.
 

Promotion Ad

For developers, every APP has a certain life cycle. When the APP decides to stop maintenance or launch a new APP, it needs to divert the users of the current APP to the new APP. At this time, Cross Promotion is needed.

 

Step 1. Set the Promotion Ad Listener

The OpenMediation SDK fires several events to inform you of Promotion Ad activity, such as ad availability and completions, so you will know whether and when to reward your users. To serve Promotion Ad, you need to first set its listeners and process ad events. The following snippet demonstrates how to implement the PromotionAdListener interface to receive video ad events.

The SDK will notify the listener of all possible events listed below:

import com.openmediation.sdk.promotion.PromotionAd;
import com.openmediation.sdk.promotion.PromotionAdListener;
import com.openmediation.sdk.promotion.PromotionAdRect;
...
PromotionAd.setAdListener(new PromotionAdListener() {

    /**
     * called when Ad availability changed
     *
     * @param available represent Ad available status
     */
    @Override
    void onPromotionAdAvailabilityChanged(boolean available) {
    }

    /**
     * called when promotionAd is shown
     */
    @Override
    void onPromotionAdShowed(Scene scene) {
    }

    /**
     * called when promotionAd show failed
     *
     * @param error Promotion ads show failed reason
     */
    @Override
    void onPromotionAdShowFailed(Scene scene, Error error) {
    }

    /**
     * called when promotionAd closes
     */
    @Override
    void onPromotionAdHidden(Scene scene) {
    }

    /**
     * called when promotionAd is clicked
     */
    @Override
    void onPromotionAdClicked(Scene scene) {
    }

});
 

Step 2. Show the Promotion Ad

Ad Availability

OpenMediation SDK automatic loads ads for you to cache the Promotion Ads during application lifecycle if only SDK is integrated and initiated successfully. By correctly implementing the PromotionAdListener , you will be notified about the ad availability through the onPromotionAdAvailabilityChanged callback. 

@Override 
void onPromotionAdAvailabilityChanged(boolean available) {
}
Another way to check if the ad is available is by calling the isReady() function directly. 
boolean ready = PromotionAd.isReady();
 

Show Promotion Ad

The aspect ratio of cross-promotion ads is 132:153. We recommend that you set the size according to this ratio. We recommend checking the ad's availability by isReady method before you show Ad to your users, as shown in the following code:

if (PromotionAd.isReady()) {
    PromotionAdRect adRect = new PromotionAdRect();
    // Ad width,Unit dp (must be positive)
    adRect.setWidth(132);
    // Ad height,Unit dp, When both width and height are set, the height will be dynamically set based on the width.
    adRect.setHeight(153);
    // The distance from the left side of the screen, the value is 0~1, default 0
    adRect.setScaleX(0);
    // The distance from the top side of the screen, the value is 0~1, default 0
    adRect.setScaleY(0.07f);
    // Take the center as the dot and rotate the angle clockwise, default 0
    adRect.setAngle(10);
    PromotionAd.showAd(this, adRect, "sceneName");
}
device-2020-12-31-144409.png
 
Note: The specific placement of the ad will be affected by the theme of the current Activity. To successfully display the check promotion ad, you also need to set the hardwareAccelerated of the activity level to true.
<activity android:hardwareAccelerated="true" />
Hide Promotion Ad
PromotionAd.hideAd();
 

Done! 
You are now all set to deliver Promotion ads in your app!

What's Next:

Follow our integration guides to integrate additional Rewarded Video Ad networks on our Mediation platform or configure additional Ad Units:

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.