我一直在发布此广告,但广告未出现在我的Android应用中。我正在寻找间隙和底部中心(没有别的)。任何人都可以告诉我我的代码错误吗?我可以将它发布到设备上而没有任何错误,swc和ane文件的路径是准确的。但是......当我尝试在设备上测试时,没有广告显示!通常你会看到Google"填充物"横幅。
import flash.display.MovieClip;
import flash.events.MouseEvent;
import com.milkmangames.nativeextensions.*;
import com.milkmangames.nativeextensions.events.*;
import com.model.Model;
if (! Model.isAdCreated) {
if (! AdMob.isSupported) {
log("AdMob is not supported on this platform.");
return;
}
AdMob.init("ca-app-pub-0689398111452070/6711053641");
log("AdMob v"+AdMob.VERSION+" Initialized!");
//AdMob.enableTestDeviceIDs(AdMob.getCurrentTestDeviceIDs());
AdMob.addEventListener(AdMobErrorEvent.FAILED_TO_RECEIVE_AD,onFailedReceiveAd);
AdMob.addEventListener(AdMobEvent.RECEIVED_AD,onReceiveAd);
AdMob.addEventListener(AdMobEvent.SCREEN_PRESENTED,onScreenPresented);
AdMob.addEventListener(AdMobEvent.SCREEN_DISMISSED,onScreenDismissed);
AdMob.addEventListener(AdMobEvent.LEAVE_APPLICATION,onLeaveApplication);
Model.isAdCreated=true;
}
function showSmartBanner():void {
log("->display smart banner.");
AdMob.showAd(AdMobAdType.SMART_BANNER, AdMobAlignment.CENTER, AdMobAlignment.BOTTOM);
log("Requested show smart banner.");
}
function showAdTopLeft():void {
log("->display ad top left...");
AdMob.showAd(AdMobAdType.BANNER, AdMobAlignment.LEFT, AdMobAlignment.TOP);
log("Requested show ad top left.");
}
function showAdTopRight():void {
log("->display ad top right...");
AdMob.showAd(AdMobAdType.BANNER, AdMobAlignment.RIGHT, AdMobAlignment.TOP);
log("Requested show ad top right.");
}
function showAdBottomCenter():void {
log("->display ad bottom center...");
AdMob.showAd(AdMobAdType.BANNER, AdMobAlignment.CENTER, AdMobAlignment.BOTTOM);
log("Requested show ad bottom center.");
}
function showInterstitialAd():void {
log("Loading interstitial..// pass false for preoading only");
AdMob.loadInterstitial("ca-app-pub-0689398111452070/8187786843", true);
log("Waiting for interstitial to auto-show.");
}
function refreshIt():void {
log("Refreshing banner ad.");
AdMob.refreshAd();
}
function removeAd():void {
AdMob.destroyAd();
log("->ad destroyed");
}
function onFailedReceiveAd(e:AdMobErrorEvent):void {
log("ERROR receiving ad, reason: '"+e.text+"'");
}
function onReceiveAd(e:AdMobEvent):void {
log("Received ad:"+e.isInterstitial+":"+e.dimensions);
showSmartBanner();
}
function onScreenPresented(e:AdMobEvent):void {
log("Screen Presented.");
}
function onScreenDismissed(e:AdMobEvent):void {
log("Screen Dismissed.");
}
function onLeaveApplication(e:AdMobEvent):void {
log("Leave Application.");
}
function log(msg:String):void {
trace("[AdMobExample] "+msg);
//txt.appendText(msg+"\n");
}
答案 0 :(得分:0)
看起来onInceiveAd处理程序可能会在插页式显示时被调用。然后显示的横幅可能正在关闭插页式广告。