3

Currently when trying to load an interstitial, there is a timeout for the request (which I have noted) of 30 seconds or so. I would like to reduce that to 10-15 seconds, but I am unable to find a method to set the timeout value.

Is there such a thing in the SDK or do I need to implement my own timer?

AdRequest adRequest = new AdRequest.Builder().build();
mInterstitial.loadAd(adRequest);
            mInterstitial.setAdListener(new AdListener() {
                @Override
                public void onAdLoaded() {
                    super.onAdLoaded();
                    mInterstitial.show();
                }

                @Override
                public void onAdFailedToLoad(int errorCode) {
                    super.onAdFailedToLoad(errorCode);
                    jumpToMainActivity();
                }

                @Override
                public void onAdClosed() {
                    super.onAdClosed();
                    jumpToMainActivity();
                }
            });
AndreiBogdan
  • 10,858
  • 13
  • 58
  • 106

1 Answers1

0

NB you should NOT be calling interstitial.show() from onAdLoaded() unless you want your account banned.

I suspect that is why you want to reduce the timeout. If that's the case then the answer is you don't want to reduce the time out, you want to choose a natural point in your app's flow to show the interstitial.

William
  • 20,150
  • 8
  • 49
  • 91
  • I know it's not the proper place to call the .show() method, but in my case it is. I'm waiting for the ad to load (or fail) before exiting the splashscreen. So it's fine. – AndreiBogdan May 12 '16 at 11:48
  • OK. But Admob has repeatedly warned that showing interstitials at that point is against policy. So you are likely to have your account banned. – William May 12 '16 at 13:02
  • It depends what action you block until the ad is loaded. For me, I think, it makes sense in some cases to show the ad when loaded. The disadvantage is that you block until timeout when no internet connection is available. – Denny Weinberg Jun 14 '17 at 19:36
  • did you find any solution for that ? – Brahem Mohamed Apr 20 '21 at 23:24