I have a delay problem with some adMob interstitials, which can lead to undue clicks, until these days everything was fine, but I do not know why it started right away.
My code follows the Google standard, I suspect that some advertisements do not load on time causing this delay to show.
The Java code is this:
private void requestNewInterstitial() {
AdRequest adRequest = new AdRequest.Builder().build();
interstitial.loadAd(adRequest);
}
No onCreate
// Criar o anúncio intersticial.
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId(ADMOB_INTERSTICIAL); //meu codigo adMob
// importante colocar este codigo aqui
interstitial.setAdListener(new AdListener() {
@Override
public void onAdClosed() {
requestNewInterstitial();
}
});
requestNewInterstitial();
The method:
// Chamar displayInterstitial() quando você estiver pronto para exibir um
// intersticial.
public void displayInterstitial() {
if (interstitial.isLoaded()) {
interstitial.show();
}
}
I ran several tests, and I realized that the best way was to remove from AndroidManifest.xml
this line here.
android:theme="@android:style/Theme.Translucent"
On Google's website, ask to stay like this,
android:configChanges="keyboard|keyboardHidden|orientation|
screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
theme , I have some landscape mode apps that look cool with this line, but it's not going to work.
Does anyone know what might be happening?