Delay and problem with interstitial ads

2,549 views
Skip to first unread message

Sergio

unread,
Nov 4, 2015, 6:14:22 AM11/4/15
to Google Mobile Ads SDK Developers
I have admob ads working in my app since a long time ago. But recently I noticed a problem: interstitial ads are shown with a delay of about 1 second (yes, I load them before show, and I only show them if they are loaded). And when I close them, my Activity doesn't work properly (I have a ListView, and after close a "problematic interstitial", my ListView rows are not updating when I call notifyDatasetChanges, changes are seen only when I scroll the list until updated row disappears, and I scroll back to see the updated row).

It happens with some real ads, and with every test ads. I noticed that the interstitials that are delayed, are the ones are showing a rounded close button at top-left corner. I attach a screenshot.

Is it a known issue? I'm using play-services-ads:8.1.0
Screenshot_20151104-114130.png

Sergio

unread,
Nov 4, 2015, 3:38:54 PM11/4/15
to Google Mobile Ads SDK Developers
This is happening in my published app (last updated two months ago). And it started happening yesterday, so this must be an issue from AdMob.

After the interstitial is closed, my app is not working (views are not responding correctly)

Any help please?

Vu Chau (MobileAds SDK Team)

unread,
Nov 4, 2015, 4:50:16 PM11/4/15
to Google Mobile Ads SDK Developers
Hi Sergio,

Thanks for letting us know about this.  As far as I can remember, I haven't gotten reports of this issue before.

Are you able to reproduce this issue in our sample app (especially when using the test interstitial)?  The delay, which is minimum, might be expected given the time needed to render a loaded interstitial on screen.  I observed a small delay at this transition as well in our sample app.  But I'm not certain if the delay or the creative itself has any connection to the issue you are seeing with your ListView not getting refreshed.

When you close the interstitial, you should be notified via onAdClosed().  Here you will be updating your ListView.  In my testing, the views behave normally after closing an interstitial.  So, if you can send us a minimal code base capable of reproducing this issue, that'd be great.

Vu Chau
Mobile Ads SDK Team

Sergio

unread,
Nov 5, 2015, 3:33:25 AM11/5/15
to Google Mobile Ads SDK Developers
Hi Vu Chau,

Thanks for your response. I'm able to reproduce the issue in your sample app. I've done a very simple modification, so the issue it's easy to see. 

In your sample app, I've added 2 views, and a new button, to the activity layout. Only 1 view is visible at a time. The button switch views visibility. And when an interstitial is shown, views visibility is switched too. Ok, so these are the steps to reproduce the issue:
  1. Run my modified sample app
  2. Touch my "Switch" button multiple times to see that, every time is touched, the color view is changed, and button changes it's position.
  3. Now touch your "Retry" button, wait for the interstitial, close it, and see what happens:
    1. The switch button will not move anymore
    2. During the count down, your textview does not display the entire text
And this is another way to test my app:
  1. Ensure my modified sample app is closed
  2. Run my modified sample app
  3. Wait until countdown finishes
  4. Touch retry button, wait for the interstitial, and close it
  5. Where did my view go?
I've tested it with a Nexus 6 (Marshmallow) and Nexus 4 (Lollipop).

I only modified activity_my.xml and MyActivity.java

Are you able to reproduce the issue?

Thanks, and best regards,
Sergio.

Jose D

unread,
Nov 5, 2015, 11:06:22 AM11/5/15
to Google Mobile Ads SDK Developers
Hi, I'm also having the same problematic delay in every Interstitials, even been catched.
This has started to happen some days ago.
The delay is producing in test mode and in real (live) ads.
I have done some tests (Android 4.2.2) and the delay seems to be shorter (or disappear) when using in the manifest:

<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

Instead of

<activity android:name="com.google.android.gms.ads.AdActivity"
android:theme="@android:style/Theme.Translucent"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

(not including the translucent theme property).
As its recommended from Admob docs.
Am I right?

This is annoying many of my users as the activity stays "irresponsive" for while.
Please some advise or help. Do I have to update all my apps removing the translucent theme?
Thanks
Jose.

Vu Chau (MobileAds SDK Team)

unread,
Nov 5, 2015, 4:50:58 PM11/5/15
to Google Mobile Ads SDK Developers
Sergio, thanks for the steps and the sample example! I was indeed able to reproduce some of the behaviors you described.

Question: Could you elaborate on why your code is manipulating some other views at the time of displaying the interstitial? Would you consider doing the work in onAdClosed() instead? I commented out switchViews() (below) and the reported UI problems went away.  Also calling it in onAdClosed() does not exhibit the problems again.  Generally we recommend not to increase the overhead when you know you are going to request and/or load an interstitial.  Instead, such operations can be better done once the interstitial has been dismissed.
mRetryButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        // switchViews();
        showInterstitial();
    }
});
Jose, having the translucent theme enables transparent background interstitial ad.  If somehow this attribute interferes with performance then we'll want to look deeper into this issue.  In your app, are you doing anything extra that might be UI-intensive that you could otherwise do in a background thread, such as an AsyncTask? Could you share a sample project that demonstrates the delay?

Thanks,

Vu Chau
Mobile Ads SDK Team

Sergio

unread,
Nov 5, 2015, 6:02:56 PM11/5/15
to Google Mobile Ads SDK Developers
Hi Vu Chau,

Thanks for testing my code.

In my app, I'm not modifying views in the same place that I show the interstitial. For example: I update the views in onStart, and I'm showing the interstitial in onActivityResult (when certain activities are closed). I update my activity views in onStart because I need to update them every time the activity comes to foreground. And try to use onAdClose in this case will make code more complex.

I understand that doing something while showing an ad may slow down my app, but I don't understand why it leaves my activity unusable: my list is not updated anymore, some views disappear, and others are not in a correct position. And even if I retry to update my views later, they act in a weird behavior. After an interstitial is shown, the app doesn't work correctly until I restart it.

I'm using admob since 2011, and it never happened before, don't you think it's an admob bug?

Jose D

unread,
Nov 6, 2015, 3:29:34 AM11/6/15
to Google Mobile Ads SDK Developers
Thanks Vu Chau for the quick reply!

I'm using an Activity which includes an only LinearLayout holding a SurfaceView (See code at bottom).
Maybe sometimes there could be some intensive UI work done in the "game.run()" function. But this has always been fine before.
Yesterday I did some more tests and I can confirm that disabling the Translucent flag the delay disappears.
Thanks again,
JD

Code:

class MySurfaceView extends SurfaceView implements Runnable {
Activity activity;
Context context;
Thread thread = null;
SurfaceHolder surfaceHolder;
volatile boolean running = false;

private Game game;

public MySurfaceView(Activity activity) {
super(activity);
surfaceHolder = getHolder();

this.activity= activity;
this.context= activity;
game= new Game ();
game.initialize(activity);
}

public void onResumeMySurfaceView () {
running = true;
thread = new Thread(this);
thread.start();
}

public void onPauseMySurfaceView () {
boolean retry = true;
running = false;
while (retry) {
try {
thread.join();
retry = false;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}

// @Override RUNNABLE
public void run() {

while (running) {

try { Thread.sleep(1); }
catch (Exception e) { }

if(surfaceHolder.getSurface().isValid()){
Canvas c = null;
try {
c = surfaceHolder.lockCanvas(null);
if (c!=null && game!=null) {
synchronized (surfaceHolder) {
game.run(c);
}
}
} finally {
// do this in a finally so that if an exception is thrown
// during the above, we don't leave the Surface in an
// inconsistent state
if (c != null) {
//surfaceHolder.unlockCanvasAndPost(c);
Surface surface = surfaceHolder.getSurface();
if (surface!=null && surface.isValid()) surfaceHolder.unlockCanvasAndPost(c);
}
}
}
}
}
}

Message has been deleted

Tristan Emrich

unread,
Nov 6, 2015, 2:32:48 PM11/6/15
to Google Mobile Ads SDK Developers
Hi Sergio,

Sorry to hear that you are experiencing issues with our Interstitial ads.  I was able to reproduce the "view update" issue with the sample app you provided. This definitely should not be happening.

To make sure I am understanding your issue properly, just want to make sure this is the process flow for your prod app:
1) user loads app - onStart() is called and you update your list view data - ListView is displayed
     QUESTIONS:  Do you call notifyDataSetChanged() when app is first launched in onStart()? What else do you call in onStart()?
2) load interstitial - interstitial is loaded when onActivityResult is called when certain Activities are closed - then onStart() is called where you call notifyDataSetChanged() to refresh ListView data - Interstitial is now visible to user
     QUESTIONS:  Do you start a new Activity when a row in ListView is clicked? Once that Activity is closed, the interstitial is loaded and is visible to user? 
3) user closes interstitial - ListView is visible; however, the data is not properly updated and View is not displayed properly << THIS IS WHERE YOU RUN INTO THE ISSUE >>
    QUESTION:  Other than the data not updating in ListView, what View issues are you experiencing?

Thank you!
Tristan

Tristan Emrich

unread,
Nov 6, 2015, 2:54:05 PM11/6/15
to Google Mobile Ads SDK Developers
Sergio,

Few additional questions:
1) How are you setting up your ListView? Are you using an ArrayAdapter? Are you modifying your list and calling notifyDataSetChanged() similar to this?

Sergio

unread,
Nov 8, 2015, 6:20:32 AM11/8/15
to Google Mobile Ads SDK Developers
Hi Tristan,

Thanks for your response.

I created another Android project based on your sample app to answer all your questions. This project reproduces the problem with my list view: https://dl.dropboxusercontent.com/u/21594584/InterstitialExampleList.zip

Steps to reproduce:
  1. Run the app
  2. Press any "play" button in any row, the times you want. You will see that button will change.
  3. Touch "open new activity" button
  4. Touch "close" button
  5. Now, an interstitial is shown (please notice the delay)
  6. Close the interstitial
  7. Touch any button in the list: you will see now it doesn't change
  8. Now scroll the list and you will see now the button changes
To summarize, these are the problems I'm having:
  • Problem 1: Updating views visibility (explained in my first project, linked in a previous post)
  • Problem 2: Updating list view items (explained in the project linked in this post)
  • Problem 3: Delay when showing an interstitial (noticeable in both projects)
And this is how I'm solving these problems:
  • Problem 1: I can solve it in two ways:
    • If I call switchViews() and then showInterstitial(), it fails. But if I call showInterstitial() and then switchViews(), it seems to be working well (but I can not trust in this solution because it's a bit weird and I don't know why it's working)
    • If I call showInterstitial() and then, in onAdClosed, I call switchViews, it's working, and it seems to be the best way to solve it
  • Problem 2: As you can see in the attached project, I was reseting all list items in onStop. If I do it in onStart instead, it's working.
  • Problem 3: I don't know how to solve this problem... I've never seen this problem with AdMob ads before, and I'm using them since 2011. As you can see in the project I attach in this post, when you close the second activity, and you return to the first one, there is a delay until the ad is shown. This is a bad experience for the user, and it will make him to click ads unintentionally. So it will generate invalid clicks and this is not good....
    To solve it, I've been thinking in showing a full screen black view when I call showInterstitialAd(), so the user knows an ad will show because he sees a black screen during the delay, and it will avoid invalid clicks. But... this solution take us back to problem 1: switching views visibility when an interstitial ad is shown... This is a real problem...
I'm not the only one having this issue. I've found this thread in stackoverflow: http://stackoverflow.com/questions/33545184/interstitial-ad-is-displayed-with-delay

Please, let me know if you need more info about it, or if I can help in anyway.

Thanks, and regards,
Sergio.

Tristan Emrich

unread,
Nov 8, 2015, 5:32:34 PM11/8/15
to Google Mobile Ads SDK Developers
Hi Sergio,

Thank you for getting back to me and providing another sample app.  

I was able to create a sample app as well that shows the delay with displaying the interstitial.  Will check with the Engineering team on Monday to see what might be causing the delay and what process flow they recommend using for displaying an interstitial after an Activity is closed.

I will hopefully have a response for you tomorrow afternoon. 

Tristan

Sergio

unread,
Nov 9, 2015, 4:03:05 AM11/9/15
to Google Mobile Ads SDK Developers
Thank you Tristan, I'll be waiting for your response.

Tristan Emrich

unread,
Nov 9, 2015, 2:58:28 PM11/9/15
to Google Mobile Ads SDK Developers
Hi Sergio,

I spoke with the Engineering team and showed them the delay issues with the Interstitial ad. Looks like the delay is more noticeable with latest Google Play Services compared to older one's. I filed a bug and will have them look into what is causing this issue.

Will keep you updated as I get more information from the Engineering team. 

Thank you for your patience!

Tristan

Sergio

unread,
Nov 9, 2015, 3:06:56 PM11/9/15
to Google Mobile Ads SDK Developers
Hi Tristan,

Thanks for communicating it to the engineering team. I hope they fix it soon, so I can activate again image and text interstitial ads. I have seen other developers having similar issues, like this one: http://stackoverflow.com/questions/33595325/admob-interstitial-with-viewpager-issues-after-dismiss.

As I said: please let me know if I can help in anyway.

Thanks, and best regards,
Sergio.

Sergio

unread,
Nov 12, 2015, 3:34:14 AM11/12/15
to Google Mobile Ads SDK Developers
Hi,

I've just noticed that test ads are showing without delay again, and views are working as expected! So... is the issue fixed? Is it safe to re-enable interstitial ads in my prod app?

Thanks, and best regards,
Sergio.

Tristan Emrich

unread,
Nov 12, 2015, 12:17:48 PM11/12/15
to Google Mobile Ads SDK Developers
Hi Sergio,

I am not seeing the delay on my end either. Looks like it is working properly. I just pinged the Engineering team to get an update on the issue, so will respond once I hear back.

Thank you!
Tristan

Sergio

unread,
Nov 12, 2015, 12:20:09 PM11/12/15
to Google Mobile Ads SDK Developers
Ok Tristan. Please let me know if the Engineering team has fixed completely the issue, and it's safe to re-enable interstitial ads in my prod app.

Thanks, and best regards,
Sergio

Tristan Emrich

unread,
Nov 13, 2015, 11:16:17 AM11/13/15
to Google Mobile Ads SDK Developers
Hi Sergio,

Looks like the Engineering team was able to fix the issue. It should be safe to re-enable interstitial ads in your prod app.

Thank you for identifying this issue.  Really appreciate it!

Tristan

Sergio

unread,
Nov 13, 2015, 11:18:40 AM11/13/15
to Google Mobile Ads SDK Developers
Hi Tristan,

Thank you! I'm going to re-enable interstitial ads! :)

Thanks again!
Sergio.
Reply all
Reply to author
Forward
0 new messages