Interstitial ad onAdClosed call is being delayed

995 views
Skip to first unread message

Techie Zeeshan

unread,
May 13, 2019, 10:31:57 AM5/13/19
to Google Mobile Ads SDK Developers
I have loaded the interstitial ads in onCreate like this:
{
@Override
protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 ButterKnife.bind(this);
if (prefManager.shouldShowInterstitialAd()) {
 interstitialAd = new InterstitialAd(this);
 interstitialAd.setAdUnitId(prefManager.getInterstitialAdId());
 if (!interstitialAd.isLoading() && !interstitialAd.isLoaded()) {
 interstitialAd.loadAd(new AdRequest.Builder().addTestDevice("882530CA8147915F79DF99860BF2F5B0").addTestDevice("66E8C013823778CF645C155B24115C9F").build());
 }
}

 interstitialAd.setAdListener(new AdListener() {
 @Override
 public void onAdClosed() {
 super.onAdClosed();
 if (!interstitialAd.isLoaded() && !interstitialAd.isLoading()) {
 interstitialAd.loadAd(new AdRequest.Builder().addTestDevice("882530CA8147915F79DF99860BF2F5B0").addTestDevice("66E8C013823778CF645C155B24115C9F").build());
 if (intentToLiveTVListActivityFromTab) {
 intentToLiveTVListActivityFromTab = false;
 startIntentToLiveTVListActivity();
 viewPager.setCurrentItem(previousTabIndex);
 tabLayout.setupWithViewPager(viewPager);
 } else if (intentToLiveTVListActivity) {
 intentToLiveTVListActivity = false;
 startIntentToLiveTVListActivity();
 } else if (intentToVideoActivity) {
 intentToVideoActivity = false;
 startIntentToVideoActivity();
 } else if (intentToCategoryActivity) {
 intentToCategoryActivity = false;
 startIntentToCategoryActivity(fromNavDrawer, positionForCategoryActivity);
 } else if (intentToPrivacyPolicy) {
 intentToPrivacyPolicy = false;
 startIntentToPrivacyPolicy();
 } else if (intentToWebView) {
 intentToWebView = false;
 startIntentToSpecialWebView();
 }
 }
 }


 @Override
 public void onAdFailedToLoad(int i) {
 super.onAdFailedToLoad(i);
 Log.e("Failed interstitial", "Error code: " + i);
 }
 });
}
@Override
public void onItemClick(View view, int position) {
 Commons.logSectionItemClicked(mFirebaseAnalytics, sections.get(position).getSection());

 if (interstitialAd != null && interstitialAd.isLoaded()) {
 interstitialAd.show();
 } else {
 if (response.getSections().get(position).getSection().toLowerCase().contains("live")) {
 startIntentToLiveTVListActivity();
 return;
 } else if (response.getSections().get(position).getSection().toLowerCase().contains("video")) {
 startIntentToVideoActivity();
 return;
 }
 startIntentToCategoryActivity("false", position);
 }

 if (response.getSections().get(position).getSection().toLowerCase().contains("live")) {
 intentToLiveTVListActivity = true;
 return;
 } else if (response.getSections().get(position).getSection().toLowerCase().contains("video")) {
 intentToVideoActivity = true;
 return;
 }
 intentToCategoryActivity = true;
 fromNavDrawer = "false";
 positionForCategoryActivity = position;
}

}

or check the attachment for the full java code

The issue is, after interstitial ad is closed, it is not calling onAdClosed immediately. It is getting a delay of 2 or 3 seconds.

MainActivity.java

mobileadssdk...@google.com

unread,
May 13, 2019, 5:13:27 PM5/13/19
to Techie Zeeshan, Google Mobile Ads SDK Developers
Hello Zeeshan, 

I was able to check that the onAdClosed is not delayed with our sample apps. Could you please confirm if the call back triggering is delayed or the logic implemented within the callback is delayed? Could you please log the ad events and share the Network tracing logs to troubleshoot this?

Thanks,
Bharani Cherukuri
Mobile Ads SDK Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Techie Zeeshan

unread,
May 14, 2019, 2:03:40 AM5/14/19
to Google Mobile Ads SDK Developers
Hello Bharani Cherukuri,
I wanted to let you know that, this is happening only when video ad is played in interstitial. I don't see such issue with a image interstitial.

Though, I'll test to check whether the onAdClosed callback is delayed or my code.

Techie Zeeshan

unread,
May 14, 2019, 3:03:46 AM5/14/19
to google-adm...@googlegroups.com
I have just checked whether the onAdClosed is getting delayed or not, and the result is indeed it is getting delayed.
i added Log.e("TEST", "onAdClosed"); inside OnAdClosed next line to super method.

after closing ad in phone, the above log is getting printed after a second or two. after seeing the log, immediately my next activity is opening. So there is no issue with my code.

Check attachment for the network tracing logs.
logs.txt

Techie Zeeshan

unread,
May 14, 2019, 3:35:21 AM5/14/19
to Google Mobile Ads SDK Developers
Hey,I have tested with Google sample app. I replaced app id and ad unit id and also added my phone as test device. if the interstitial plays a video, then only OnAdClosed callback is getting delayed.

mobileadssdk...@google.com

unread,
May 14, 2019, 3:01:24 PM5/14/19
to Techie Zeeshan, Google Mobile Ads SDK Developers
Hello Zeeshan, 

Your response missed the attachments. Could you please share the sample project which includes the Ad Unit Ids that you're testing? You can share the details privately via Reply privately to author option.

Regards,

Techie Zeeshan

unread,
May 16, 2019, 3:37:35 AM5/16/19
to Google Mobile Ads SDK Developers
I have sent you logs and sample project in private reply. Please check it.

mobileadssdk...@google.com

unread,
May 16, 2019, 3:24:18 PM5/16/19
to Techie Zeeshan, Google Mobile Ads SDK Developers
Hello Zeeshan, 

Thank you for the details. I tested the shared sample app and I was able to load only non-video ads. Could you please share us the Charles Proxy logs with SSL Proxy enabled to share it with the team for further investigation?

You can share the details privately via Reply privately to author option.

Regards,
Bharani Cherukuri
Mobile Ads SDK Team

Techie Zeeshan

unread,
May 20, 2019, 1:03:15 PM5/20/19
to Google Mobile Ads SDK Developers
I have sent you new app id and ad unit id in private reply.
Kindly test with them.

Mobile Ads SDK Forum Advisor Prod

unread,
May 21, 2019, 10:11:50 AM5/21/19
to sdz...@gmail.com, google-adm...@googlegroups.com
Hello Zeeshan, 

Thank you for sharing the Ad Unit Ids. I was able to load the video ads and the onAdClosed() is called immediately after the close button is clicked. It could be an issue with the implementation. We suggest that you recheck your implementation with our sample apps and see if the issue is reproducible. If so, could you please capture the device logs logging the ad events to check this further?

Regards,
Bharani Cherukuri
Mobile Ads SDK Team

ref:_00D1U1174p._5001UAqARK:ref

Techie Zeeshan

unread,
May 22, 2019, 2:56:44 AM5/22/19
to Google Mobile Ads SDK Developers
I have attached the .chls file which is Charles Proxy logs with SSL Proxy. Kindly check it. And yes, i have checked with google sample code only. In that app also, onAdClosed is getting delayed.
admob charles.chls

Mobile Ads SDK Forum Advisor Prod

unread,
May 22, 2019, 2:26:23 PM5/22/19
to sdz...@gmail.com, google-adm...@googlegroups.com
Hello Zeeshan, 

Could you please share the logs enabling the SSL Proxy? Could you also share the complete device logs logging the ad events (when the ad is opened and ad is closed)? This will help us troubleshoot the issue.

Thanks,

Techie Zeeshan

unread,
May 23, 2019, 1:57:05 AM5/23/19
to Google Mobile Ads SDK Developers
Please tell me how to log the entire device logs..

Mobile Ads SDK Forum Advisor Prod

unread,
May 23, 2019, 2:58:54 PM5/23/19
to sdz...@gmail.com, google-adm...@googlegroups.com
Hi Zeeshan, 

You may find the steps to enable the SSL Proxy here. To share the complete device logs, could you please add the ad events as mentioned in this guide and share the Network tracking logs from the console? This helps us take a look at the delay you're experiencing. You can share the details privately via Reply privately to author option.

Techie Zeeshan

unread,
May 31, 2019, 6:23:12 AM5/31/19
to Google Mobile Ads SDK Developers
I have done those..

you can find network tracing logs in above logcat file..

Techie Zeeshan

unread,
May 31, 2019, 6:41:11 AM5/31/19
to Google Mobile Ads SDK Developers

I have clearly mentioned in the logcat2 the events when i closed ad and the end when the onAdClosed got called..

If something is still missing, please, let us connect using teamviewer. I need this to be fixed..

Mobile Ads SDK Forum Advisor Prod

unread,
May 31, 2019, 5:07:45 PM5/31/19
to sdz...@gmail.com, google-adm...@googlegroups.com

Hello there,

I notice that you have added a Alertdialog callback when onAdClosed() is called. Can you check if this issue is still occurring when there is no callback? We will then debug this further.

Regards,
Deepika Uragayala
Mobile Ads SDK Team



ref:_00D1U1174p._5001UAqARK:ref

Techie Zeeshan

unread,
Jun 1, 2019, 1:35:16 AM6/1/19
to Google Mobile Ads SDK Developers
The logs which i provided to you are from Admob Interstitial Example app. Not from my project.. Delay is happening in both my project and your admob interstitial example app.. And, the log: D/Admob: onAdClosed is the first line in onAdClosed method. So, there's is nothing issue with AlertDialog. Please debug this.

Mobile Ads SDK Forum Advisor Prod

unread,
Jun 3, 2019, 3:50:59 PM6/3/19
to sdz...@gmail.com, google-adm...@googlegroups.com
Hello Zeeshan,

Can you please provide us the Charles Proxy logs again with SSL Proxy enabled so I can take a look? You can refer to this Help Center Article on how to properly set it up. You can reply back via Reply privately to author option.

szwarc...@gmail.com

unread,
Sep 11, 2020, 9:07:09 AM9/11/20
to Google Mobile Ads SDK Developers
I have the same problem, the  onAdClosed event is delayed, sometimes 1 sec sometimes 3 sec
Any progress on that?

Koradiya Abhay

unread,
Jul 19, 2021, 3:54:02 AM7/19/21
to Google Mobile Ads SDK Developers
Why you can't reproduce this?
I also facing the same issue.
After tapping on close in Interstitial screen, onAdDismissedFullScreenContent called after 2-3 sec.

Check here also. -> https://github.com/googleads/googleads-mobile-android-examples/issues/361

Mobile Ads SDK Forum Advisor

unread,
Jul 19, 2021, 6:06:21 AM7/19/21
to abkora...@gmail.com, google-adm...@googlegroups.com

Hello Koradiya,

Thank you for reaching out to us.

Could you please provide the following details via Reply privately to author option or send it directly to mobileads...@gmail.com? Kindly inform us on this thread if you sent it directly to the email provided.

  • Sample app(if any)
  • Steps to replicate
  • Charles log
  • SDK version

Regards,

Google Logo
Princess Pamela Pineda
Mobile Ads SDK Team
 

 



ref:_00D1U1174p._5001UAqARK:ref
Reply all
Reply to author
Forward
0 new messages