j'ai développé une application Android et j'ai intégré interstitiel AdMob de Google. Le problème est que sur l'émulateur, la publicité est affichée avec succès mais sur mon appareil elle n'apparaît pas. J'ai créé l'identifiant d'unité publicitaire que j'ai créé sur AdMob et j'ai lié l'application à adMob.Pourquoi les annonces interstitielles ne présentant pas sur l'appareil
Voici mon code:
InterstitialAd mInterstitialAd;
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId(getString(R.string.interstitial_full_screen));
AdRequest adRequest = new AdRequest.Builder().build();
// Load ads into Interstitial Ads
mInterstitialAd.loadAd(adRequest);
mInterstitialAd.setAdListener(new AdListener() {
public void onAdLoaded() {
showInterstitial();
}
});
maintenant la fonction showInterstitial():
private void showInterstitial() {
Random r = new Random();
if (mInterstitialAd.isLoaded()) {
new android.os.Handler().postDelayed(
new Runnable() {
public void run() {
mInterstitialAd.show();
AdRequest adRequest = new AdRequest.Builder().build();
mInterstitialAd.loadAd(adRequest);
}
},
r.nextInt(7000 - 5000) + 5000);
}
}
J'ai ajouté un délai d'attente aléatoire et lorsque l'annonce est chargé, il sera affiché.
et dans mon dossier, je gradle ajouté ce qui suit:
compile 'com.google.android.gms:play-services-ads:9.8.0'
NB. J'ai une autre bannière publicitaire dans l'application.
sur l'émulateur, il fonctionne très bien voici une capture d'écran:
Quelqu'un a une idée pourquoi l'annonce interstitiel ne montre pas sur les appareils? . Je vous remercie.
Quel code d'erreur recevez-vous? Vérifiez la sortie de Logcat. – earthw0rmjim