Interstitial Ad displayed strangely (sometimes)

mopub
android

#1

Hi, we’ve been using MoPub for a long time and now we wanted to integrate Interstitial ads. The code is same as in the integration guide, using the latest version (com.mopub:mopub-sdk:4.11.0@aar), however it works only sometimes. The other times the ad place is empty or the ad is loaded but shown screwed (please see screenshots below).

Tested on Samsung Galaxy A3 2016 (Android 6.0.1) and Sony Xperia Z (Android 5.1.1) getting the same behavior.

Any ideas what to do? And sorry for a long post :).

public class InterstitialAdActivity extends Activity implements MoPubInterstitial.InterstitialAdListener {
private MoPubInterstitial mInterstitial = null;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.interstitialad);

        mInterstitial = new MoPubInterstitial(this, App.MOPUB_INTERSTITIAL_ID);
        mInterstitial.setInterstitialAdListener(this);

    mInterstitial.load();
}

@Override
public void onInterstitialLoaded(MoPubInterstitial interstitial) {
    if (interstitial.isReady())
        mInterstitial.show();
    else
        InterstitialAdActivity.this.finish();
}

@Override
public void onInterstitialFailed(MoPubInterstitial interstitial, MoPubErrorCode errorCode) {
    Log.d("custom", "MoPub Interstitial error: " + errorCode);
    InterstitialAdActivity.this.finish();
}

@Override
public void onInterstitialShown(MoPubInterstitial interstitial) {
}

@Override
public void onInterstitialClicked(MoPubInterstitial interstitial) {

}

@Override
public void onInterstitialDismissed(MoPubInterstitial interstitial) {
    InterstitialAdActivity.this.finish();
}

@Override
protected void onDestroy() {
    if (mInterstitial != null)
        mInterstitial.destroy();
    super.onDestroy();
}

}

Layout is as follows:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" android:background="#333">
    <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        />
    </LinearLayout>
</FrameLayout>

The logcat (filtered for the mopub keyword) is:

11-11 12:09:10.561 17396-17396/com.androidsk.tvprogram D/MoPub: Third-party network timed out.
11-11 12:09:11.501 17396-17396/com.androidsk.tvprogram D/MoPub: Loading url: http://ads.mopub.com/m/ad?v=6&id=f41f4bce7b404a6fbae19eeda5de9ede&nv=4.9.0&dn=samsung%2CSM-A310F%2Ca3xeltexx&bundle=com.androidsk.tvprogram&z=%2B0100&o=p&w=720&h=1280&sc_a=2.0&mcc=230&mnc=03&iso=cz&ct=2&av=2.1.5&udid=mp_tmpl_advertising_id&dnt=mp_tmpl_do_not_track&mr=1&android_perms_ext_storage=1
11-11 12:09:11.561 17396-17396/com.androidsk.tvprogram D/MoPub: Refresh disabled for ad unit (agltb3B1Yi1pbmNyDQsSBFNpdGUYhKTcCAw).
11-11 12:09:12.191 17396-17396/com.androidsk.tvprogram D/MoPub: Loading custom event interstitial adapter.
11-11 12:09:12.191 17396-17396/com.androidsk.tvprogram D/MoPub: Attempting to invoke custom event: com.mopub.mraid.MraidInterstitial
11-11 12:09:12.231 17396-17396/com.androidsk.tvprogram I/chromium: [INFO:CONSOLE(1)] "Uncaught ReferenceError: mraid is not defined", source: http://ads.mopub.com/ (1)
11-11 12:09:13.161 2805-3833/? V/WindowManager: addAppToken: AppWindowToken{d04d1b1d4 token=Token{ba46b27 ActivityRecord{3e1b9e6 u0 com.androidsk.tvprogram/com.mopub.mobileads.MraidActivity t1754}}} to stack=1 task=1754 at 0
11-11 12:09:13.291 2805-2827/? D/StatusBarManagerService: manageDisableList userId=0 what=0x0 pkg=Window{ff99679 u0 d0 p17396 com.androidsk.tvprogram/com.mopub.mobileads.MraidActivity}
11-11 12:09:13.311 17396-17396/com.androidsk.tvprogram D/MoPub: Tracking impression for interstitial.
11-11 12:09:13.321 2805-3863/? V/WindowStateAnimator: Finishing drawing window Window{ff99679 u0 d0 p17396 com.androidsk.tvprogram/com.mopub.mobileads.MraidActivity}: mDrawState=DRAW_PENDING
11-11 12:09:13.341 2805-2832/? I/ActivityManager: Displayed com.androidsk.tvprogram/com.mopub.mobileads.MraidActivity: +156ms
11-11 12:09:13.361 2805-3622/? V/WindowStateAnimator: Finishing drawing window Window{ff99679 u0 d0 p17396 com.androidsk.tvprogram/com.mopub.mobileads.MraidActivity}: mDrawState=HAS_DRAWN
11-11 12:09:13.551 17396-17396/com.androidsk.tvprogram D/MoPub: Successfully hit tracking endpoint: http://ads.mopub.com/m/imp?appid=&cid=5d759a6e3c614130ae4254cf31a8c94b&city=Olomouc&ckv=2&country_code=CZ&cppck=71D40&dev=SM-A310F&exclude_adgroups=2823a2231e1946138034df0df003a229&id=f41f4bce7b404a6fbae19eeda5de9ede&is_mraid=1&mpx_clk=http%3A%2F%2Fmpx.mopub.com%2Fclick%3Fad_domain%3Dmobilestrikeapp.com%26ad_id%3D49491_24479%26adgroup_id%3D2823a2231e1946138034df0df003a229%26adunit_id%3Df41f4bce7b404a6fbae19eeda5de9ede%26ads_creative_id%3D5d759a6e3c614130ae4254cf31a8c94b%26app_id%3Dagltb3B1Yi1pbmNyDAsSA0FwcBiBvNwIDA%26app_name%3DTV%2520Program%26auction_time%3D1478862549%26bid_price%3D0.78%26bidder_id%3D769e546b0dd94013131c566dc23aff3a%26bidder_name%3DFractionalMedia%26campaign_id%3Dagltb3B1Yi1pbmNyOQsSCENhbXBhaWduIitta3Q6YWdsdGIzQjFZaTFwYm1OeUVBc1NCMEZqWTI5MWJuUVluWkhkQ0F3DA%26charge_price%3D0.52%26asc_price%3D0.67%26ck%3DA7E28%26ckenc%3D2%26country%3DCZE%26creative_id%3D24479%26currency%3DUSD%26impression_id%3D3797fd78-a116-45f6-8e28-fb65d2327369%26latency%3D0.031%26mopub_id%3Difa%253Aaedcad82-a262-4037-ad3e-a70a368ecaa0%26paid%3D0%26pub_id%3Dagltb3B1Yi1pbmNyEAsSB0FjY291bnQYnZHdCAw%26pub_name%3DTIVIKO%252C%2520s.r.o.%26pub_rev0%3D9206212691733802654%26request_id%3D180faea0c9684d0fbfabb144c930122c%26units%3D0%26adgroup_type%3Dmarketplace%26adgroup_priority%3D11&os=Android&osv=6.0.1&req=180faea0c9684d0fbfabb144c930122c&reqt=1478862549.0&rev=0.000265&udid=ifa%3Aaedcad82-a262-4037-ad3e-a70a368ecaa0&video_type=
11-11 12:09:13.591 2805-2832/? I/Timeline: Timeline: Activity_windows_visible id: ActivityRecord{3e1b9e6 u0 com.androidsk.tvprogram/com.mopub.mobileads.MraidActivity t1754} time:99151505
11-11 12:09:13.801 17396-17396/com.androidsk.tvprogram D/MoPub: MRAID state set to DEFAULT
11-11 12:09:13.801 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	mraidbridge.setState("default")
11-11 12:09:13.801 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	webviewDidAppear();
11-11 12:09:13.841 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	mraidbridge.setScreenSize(360,640);mraidbridge.setMaxSize(318,58);mraidbridge.setCurrentPosition(21,303,318,58);mraidbridge.setDefaultPosition(21,303,318,58)
11-11 12:09:13.841 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	mraidbridge.notifySizeChangeEvent(636,116)
11-11 12:09:13.851 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	mraidbridge.setSupports(true,true,true,true,true)
11-11 12:09:13.851 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	mraidbridge.setPlacementType("interstitial")
11-11 12:09:13.851 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	mraidbridge.setIsViewable(true)
11-11 12:09:13.851 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	mraidbridge.notifyReadyEvent();
11-11 12:09:13.981 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	window.mraidbridge.nativeCallComplete("usecustomclose")

The empty case is as follows:

11-11 12:11:03.761 17396-17396/com.androidsk.tvprogram D/MoPub: Loading url: http://ads.mopub.com/m/ad?v=6&id=f41f4bce7b404a6fbae19eeda5de9ede&nv=4.9.0&dn=samsung%2CSM-A310F%2Ca3xeltexx&bundle=com.androidsk.tvprogram&z=%2B0100&o=p&w=720&h=1280&sc_a=2.0&mcc=230&mnc=03&iso=cz&ct=2&av=2.1.5&udid=mp_tmpl_advertising_id&dnt=mp_tmpl_do_not_track&mr=1&android_perms_ext_storage=1
11-11 12:11:03.821 17396-17396/com.androidsk.tvprogram D/MoPub: Refresh disabled for ad unit (agltb3B1Yi1pbmNyDQsSBFNpdGUYhKTcCAw).
11-11 12:11:04.521 17396-17396/com.androidsk.tvprogram D/MoPub: Loading custom event interstitial adapter.
11-11 12:11:04.521 17396-17396/com.androidsk.tvprogram D/MoPub: Attempting to invoke custom event: com.mopub.mraid.MraidInterstitial
11-11 12:11:04.551 17396-17396/com.androidsk.tvprogram I/chromium: [INFO:CONSOLE(1)] "Uncaught ReferenceError: mraid is not defined", source: http://ads.mopub.com/ (1)
11-11 12:11:04.941 2805-2816/? V/WindowManager: addAppToken: AppWindowToken{d032e478c token=Token{59364bf ActivityRecord{d20bade u0 com.androidsk.tvprogram/com.mopub.mobileads.MraidActivity t1758}}} to stack=1 task=1758 at 0
11-11 12:11:05.051 2805-2827/? D/StatusBarManagerService: manageDisableList userId=0 what=0x0 pkg=Window{6dd0351 u0 d0 p17396 com.androidsk.tvprogram/com.mopub.mobileads.MraidActivity}
11-11 12:11:05.071 17396-17396/com.androidsk.tvprogram D/MoPub: Tracking impression for interstitial.
11-11 12:11:05.091 2805-2816/? V/WindowStateAnimator: Finishing drawing window Window{6dd0351 u0 d0 p17396 com.androidsk.tvprogram/com.mopub.mobileads.MraidActivity}: mDrawState=DRAW_PENDING
11-11 12:11:05.111 2805-2832/? I/ActivityManager: Displayed com.androidsk.tvprogram/com.mopub.mobileads.MraidActivity: +142ms
11-11 12:11:05.131 2805-4056/? V/WindowStateAnimator: Finishing drawing window Window{6dd0351 u0 d0 p17396 com.androidsk.tvprogram/com.mopub.mobileads.MraidActivity}: mDrawState=HAS_DRAWN
11-11 12:11:05.171 17396-17396/com.androidsk.tvprogram D/MoPub: MRAID state set to DEFAULT
11-11 12:11:05.171 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	mraidbridge.setState("default")
11-11 12:11:05.171 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	webviewDidAppear();
11-11 12:11:05.171 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:                                                                	mraidbridge.setScreenSize(360,640);mraidbridge.setMaxSize(318,0);mraidbridge.setCurrentPosition(21,320,318,0);mraidbridge.setDefaultPosition(21,320,318,0)
11-11 12:11:05.171 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	mraidbridge.notifySizeChangeEvent(636,0)
11-11 12:11:05.181 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	mraidbridge.setSupports(true,true,true,true,true)
11-11 12:11:05.191 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	mraidbridge.setPlacementType("interstitial")
11-11 12:11:05.191 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	mraidbridge.setIsViewable(true)
11-11 12:11:05.191 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	mraidbridge.notifyReadyEvent();
11-11 12:11:05.201 17396-17396/com.androidsk.tvprogram V/MoPub: Injecting Javascript into MRAID WebView:
                                                            	window.mraidbridge.nativeCallComplete("setOrientationProperties")
11-11 12:11:05.371 2805-2832/? I/Timeline: Timeline: Activity_windows_visible id: ActivityRecord{d20bade u0 com.androidsk.tvprogram/com.mopub.mobileads.MraidActivity t1758} time:99263280
11-11 12:11:05.401 17396-17396/com.androidsk.tvprogram D/MoPub: Successfully hit tracking endpoint: http://ads.mopub.com/m/imp?appid=&cid=5d759a6e3c614130ae4254cf31a8c94b&city=Olomouc&ckv=2&country_code=CZ&cppck=B92A8&dev=SM-A310F&exclude_adgroups=2823a2231e1946138034df0df003a229&id=f41f4bce7b404a6fbae19eeda5de9ede&is_mraid=1&mpx_clk=http%3A%2F%2Fmpx.mopub.com%2Fclick%3Flineitem%3D10650063%26ad_domain%3Drt.com%26adgroup_id%3D2823a2231e1946138034df0df003a229%26adunit_id%3Df41f4bce7b404a6fbae19eeda5de9ede%26ads_creative_id%3D5d759a6e3c614130ae4254cf31a8c94b%26app_id%3Dagltb3B1Yi1pbmNyDAsSA0FwcBiBvNwIDA%26app_name%3DTV%2520Program%26auction_time%3D1478862661%26bid_price%3D0.52%26bidder_id%3D0f33dczpER%26bidder_name%3DTwitter%26campaign_id%3Dagltb3B1Yi1pbmNyOQsSCENhbXBhaWduIitta3Q6YWdsdGIzQjFZaTFwYm1OeUVBc1NCMEZqWTI5MWJuUVluWkhkQ0F3DA%26charge_price%3D0.43%26asc_price%3D0%26ck%3D1AF8F%26ckenc%3D2%26country%3DCZE%26creative_id%3Dtweet_796711396759183360_Full_Text1_Image1_v1%26currency%3DUSD%26impression_id%3Dfa7c6f44-6e27-49bb-aca7-07ee95924c14%26latency%3D0.236%26mopub_id%3Difa%253Aaedcad82-a262-4037-ad3e-a70a368ecaa0%26paid%3D0%26pub_id%3Dagltb3B1Yi1pbmNyEAsSB0FjY291bnQYnZHdCAw%26pub_name%3DTIVIKO%252C%2520s.r.o.%26pub_rev0%3D9214332565323845409%26request_id%3Ddea74ea468ac4e11af0d60e1ac93f0e0%26seat_id%3Ddr%26units%3D0%26adgroup_type%3Dmarketplace%26adgroup_priority%3D11&os=Android&osv=6.0.1&req=dea74ea468ac4e11af0d60e1ac93f0e0&reqt=1478862661.0&rev=0.000219&udid=ifa%3Aaedcad82-a262-4037-ad3e-a70a368ecaa0&video_type=

And the “OK” case looks fine:


#2

Hi @horakz,

Thanks for reaching out! It sounds like this might be a one-off creative issue. If you can escalate the creative in question to our Support Team via the Creative Flagging Tool we can investigate the creative further. The Support Team can be reached at support@mopub.com.

Thanks!


#3

Thank you for your response. I was getting still the same ad, which didn’t worked in the landscape. Now it seems to be working (at least partially). Therefore I consider it as solved - I’ll try to get different ads and in case they fail, I’ll continue this thread.

Thank you once again.