I have implemented firebase ads like in the exampe:
@Override
public void onCreate(Bundle savedInstanceState) {
(...)
mAdView.loadAd(adRequestBuilder.build());
}
@Override
public void onResume() {
mAdView.resume();
}
@Override
public void onPause() {
mAdView.pause();
}
@Override
public void onDestroy() {
mAdView.destroy();
}
If the ad is successfully loaded or failed because of no Internet connection (errorCode 2) it is still going to be refreshed:
I/Ads: Scheduling ad refresh 60000 milliseconds from now.
The same message we get when we go background and then foreground (mAdView.resume()
, mAdView.pause()
).
But if we get "no fill"
No fill from ad server. Failed to load ad: 3
firebase stops requesting for new ads. It means that the user won't see any new ads (or even the first one if the first request finished with "no fill"). Furthermore if the app goes background then foreground (mAdView.resume()
is being called), the ad request still won't be performed. That means that that the user who got "no fill" can see no ads for very long time. That can lower my income.
Is it correct behavior of the ads library or is it a bug? How to resolve this problem?
Update
I have one idea. Moving mAdView.loadAd(adRequestBuilder.build())
from onCreate()
to onResume()
method force to reload the ad when user comes back from the background.
@Override
public void onResume() {
if (!mAdView.isLoading())
mAdView.loadAd(adRequestBuilder.build());
mAdView.resume();
}
What is interesting, after a lot of tests, calling mAdView.loadAd(adRequestBuilder.build())
after No fill from ad server. Failed to load ad: 3
forces to reload ad (I'm getting the message: Starting ad request.
) but it have never finished with success. I still get No fill from ad server. Failed to load ad: 3
. And the response is very quick. I assume it arrives from some kind of local cache.