Android
The CrystalExpress MoPub Adapter allows MoPub publishers to add CrystalExpress as a Custom Ad Network within the MoPub platform.
CrystalExpress provides four ad formats for MoPub mediation. The relationship between MoPub ad unit and ad format in CrystalExpress is as following:
MoPub ad unit
AD format from CrystalExpress
Banner or Medium
Card AD
Rewarded Video
Rewarded Video AD
Interstitial
Splash AD
Native
Native AD
NOTICE: The aspect ratio for CrystalExpress ad is 16:9, 4:3 or 1:1.
Before you add CrystalExpress as Custom network, you have to integrate MoPub SDK by following the instructions on the MoPub website.
NECESSARY STEPS:
Get CrystalExpress SDK and Crystal ID.
Integrate the CrystalExpress SDK.
For SDK 3.32 and above, there is no need for moat-x.jar anymore. If there was one in libs folder, please remove it. (For previous SDK version, please still copy moat-x.jar to the libs folder of your app project.
Add CrystalExpress MoPub Adapter into project.
Configure MoPub to mediate CrystalExpress.
Get CrystalExpress SDK and Crystal ID
Please contact your Intowow account manager. We will provide the right version of SDK and Crystal ID according to your needs.
Integrate the CrystalExpress SDK
Please refer to the Setup and Initialize SDK document in Android SDK
Add CrystalExpress's MoPub Adapter into project
Step 1
Contact Intowow account manager for CrystalExpress MoPub Adapter and sample code.
Step 2
Unzip CrystalExpress_MoPub_Demo_Android.zip.
For Banner
Add file
CECustomEventCard.java
andCEAdSize.java
from/MoPubDemo/app/src/main/java/com/mopub/mobileads/
to your app's project folder/src/main/java/com/mopub/mobileads/
CEAdSize
defines three ad size for the layout of ad.SMART_FULL_WIDTH: The width of the ad will match the width of the device in the current orientation and the height will automatically grow to fit the aspect ratio of creative.
SMART_AUTO: The width and height of ad will be determined by the value of ad unit.
Custom size: Create custom size for the ad.
For Native
Add files
CECustomEventNative.java
andCEAdRender.java
from/MoPubDemo/app/src/main/java/com/mopub/nativeads/
to your app's project folder/src/main/java/com/mopub/nativeads/
For Rewarded Video
Add files
CECustomEventRewardedVideo.java
from/MoPubDemo/app/src/main/java/com/mopub/mobileads/
to your app's project folder/MoPubDemo/app/src/main/java/com/mopub/mobileads/
For Interstitial
Add files
CECustomEventInterstitial.java
from/MoPubDemo/app/src/main/java/com/mopub/mobileads/
to your app's project folder/MoPubDemo/app/src/main/java/com/mopub/mobileads/
This step is necessary because the MoPub SDK references these files as “Custom Event Class properties” in the directory.
Ensure that the com.mopub.nativeads and com.mopub.mobileads packages are available in your App where you intend to integrate MoPub mediation. If not, you’ll need to create them.
If you are still having issues, please check out the sample code within download folder.
Configure MoPub to mediate CrystalExpress
Step 1
Log in to your MoPub account and register your application on your account dashboard.
1. Click Networks
tab.
2. Click Add a Network
button.
Step 2
Click
Custom Native Network
.
Step 3
Add
CrystalExpress
into Title edit box.Add the Custom Event Classes for Android:
Banner ad: enter
com.mopub.mobileads.CECustomEventCard
Native ad: enter
com.mopub.nativeads.CECustomEventNative
Interstitial ad: enter
com.mopub.mobileads.CECustomEventInterstitial
Rewarded video ad: enter
com.mopub.mobileads.CECustomEventRewardedVideo
For each unit, you will need to add a JSON object with the following keys:
placement_id
(required; JSON String): Please contact intowow account manager for this.default_title
(optional; JSON String; Native ad only): Default string for ad title.default_mainText
(optional; JSON String; Native ad only): Default string for ad main text.default_CTAText
(optional; JSON String; Native ad only): Default string for call to action text.
Step 4
Request ad follow by the instructions for Banner Integration, Native Ads Integration, Interstitial Ads Integration, Rewarded video Ads Integration from MoPub.
Proguard (Optional)
If you are using Proguard to obfuscate your code, please refer to the proguard document in Android SDK
Please keep the custom event class under your proguard rule.
The Layout of CrystalExpress AD
In MoPub custom event, our SDK will keep the aspect ratio of creatives and try to fit the ad view that you bind to MoPub.
If the aspect ratio for the ad view to be bound and the creative are inconsistent, the return ad will be filled with black background to match the aspect ratio.

Last updated