java–Admob广告服务器无法填充 – 无法加载广告:3

java–Admob广告服务器无法填充 – 无法加载广告:3,第1张

概述我的问题是广告根本没有在我的应用,测试模式中显示.我将把这个问题专门用于测试模式,一旦我开始工作,我会担心实时广告.发展信息我正在使用Eclipse进行开发.我在Android应用中使用GooglePlay服务和Admob设置了广告,如Google提供的在线文档中所述.我使用addTestDevice(“xxxxxx

我的问题是广告根本没有在我的应用,测试模式中显示.我将把这个问题专门用于测试模式,一旦我开始工作,我会担心实时广告.

发展信息

我正在使用Eclipse进行开发.

我在Android应用中使用Google Play服务和Admob设置了广告,如Google提供的在线文档中所述.

我使用addTestDevice(“xxxxxxxxxxxxxxxx”)添加了我的设备ID,并多次检查散列设备ID以确保它是正确的.

问题(见下面的日志信息)

当我在设备上运行应用程序时,根本不会显示任何广告.即使我将设备添加为测试设备,也会发生这种情况.

我已经搜索过高低,并发现了很多类似的问题,但我还没有找到这个具体问题的答案.

LogCat输出

10-28 13:56:41.659: I/Ads(1704): Starting ad request.10-28 13:56:42.187: I/Ads(1704): No fill from ad server.10-28 13:56:42.187: W/Ads(1704): Failed to load ad: 310-28 13:56:42.199: W/Ads(1704): No GMSG handler found for GMSG: gmsg://mobileads.Google.com/JsLoaded?Google.afma.Notify_dt=1414504602197

我的活动

   package bb.hopPingbird;    import org.cocos2d.layers.CCScene;    import org.cocos2d.nodes.CCDirector;    import org.cocos2d.opengl.CCGLSurfaceVIEw;    import com.Google.androID.gms.ads.AdListener;    import com.Google.androID.gms.ads.AdRequest;    import com.Google.androID.gms.ads.AdSize;    import com.Google.androID.gms.ads.AdVIEw;    import com.Google.androID.gms.ads.InterstitialAd;    import androID.app.Activity;    import androID.content.SharedPreferences;    import androID.media.MediaPlayer;    import androID.os.Bundle;    import androID.support.v4.vIEw.VIEwPager.LayoutParams;    import androID.util.displayMetrics;    import androID.vIEw.KeyEvent;    import androID.Widget.relativeLayout;    import androID.Widget.Toast;    public class MainActivity extends Activity {    private CCGLSurfaceVIEw mGLSurfaceVIEw;    //<!-- Admob Ads Using Google Play Services SDK -->    private static final String AD_UNIT_ID = "ca-app-pub-xxxxxxxxxxxxxxxxxxxx";    private static final String AD_INTERSTITIAL_UNIT_ID = "ca-app-pub-xxxxxxxxxxxxxxxxxxxx";    /** The Admob ad. */    private InterstitialAd interstitialAd = null;    public AdVIEw adVIEw = null;    public static MainActivity app;    public voID onCreate(Bundle savedInstanceState)    {        app = this;        super.onCreate(savedInstanceState);        // set vIEw        mGLSurfaceVIEw = new CCGLSurfaceVIEw(this);        //Ads ----------------        // Create the adVIEw        relativeLayout layout = new relativeLayout(this);        layout.setLayoutParams(new relativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));        //<!-- Ads Using Google Play Services SDK -->        adVIEw = new AdVIEw(this);        adVIEw.setAdSize(AdSize.SMART_BANNER);        adVIEw.setAdUnitID(AD_UNIT_ID);        // Add the adVIEw to it        relativeLayout.LayoutParams params = new relativeLayout.LayoutParams(                LayoutParams.WRAP_CONTENT,                LayoutParams.WRAP_CONTENT);        params.addRule(relativeLayout.AliGN_PARENT_BottOM, relativeLayout.TRUE);        params.addRule(relativeLayout.CENTER_HORIZONTAL, relativeLayout.TRUE);        adVIEw.setLayoutParams(params);        layout.addVIEw(mGLSurfaceVIEw);        layout.addVIEw(adVIEw);        setContentVIEw(layout);        //New AdRequest         AdRequest adRequest = new AdRequest.Builder()        .addTestDevice(AdRequest.DEVICE_ID_EMulATOR)        .addTestDevice("0D47C6944503F0284666D16BB79BF684")        .build();    // Start loading the ad in the background.    adVIEw.loadAd(adRequest);        //-----------------------------------------------------Interstitial Add        // Create an Interstitial ad.        interstitialAd = new InterstitialAd(this);        interstitialAd.setAdUnitID(AD_INTERSTITIAL_UNIT_ID);        interstitialAd.setAdListener(new AdListener() {              @OverrIDe              public voID onAdLoaded() {                interstitialAd.show();              }              @OverrIDe              public voID onAdFailedToload(int errorCode) {                  Toast.makeText(getApplicationContext(), "Interstitial Ads loading Failed", Toast.LENGTH_SHORT).show();              }        });         // Load the interstitial ad.        //showInterstitialAds();        //----------------------        // set director        CCDirector director = CCDirector.sharedDirector();        director.attachInVIEw(mGLSurfaceVIEw);        director.setAnimationInterval(1/60);        // get display info        displayMetrics displayMetrics = new displayMetrics();        getwindowManager().getDefaultdisplay().getMetrics(displayMetrics);        G.display_w = displayMetrics.wIDthPixels;        G.display_h = displayMetrics.heightPixels;        G.scale = Math.max(G.display_w/1280.0f, G.display_h/800.0f);        G.wIDth = G.display_w / G.scale;        G.height = G.display_h / G.scale;        // get data        SharedPreferences sp = CCDirector.sharedDirector().getActivity().getSharedPreferences("GameInfo", 0);        G.music = sp.getBoolean("music", true);        G.sound = sp.getBoolean("sound", true);        // create sound        G.soundMenu = MediaPlayer.create(this, R.raw.menu);        G.soundMenu.setLooPing(true);        G.soundGame = MediaPlayer.create(this, R.raw.game);        G.soundGame.setLooPing(true);        G.soundCollIDe = MediaPlayer.create(this, R.raw.collIDe);        G.soundJump = MediaPlayer.create(this, R.raw.jump);        G.soundLongJump = MediaPlayer.create(this, R.raw.long_jump);        G.soundSpeedDown = MediaPlayer.create(this, R.raw.speed_down);        G.soundSpeedUp = MediaPlayer.create(this, R.raw.speed_up);        G.soundDirection = MediaPlayer.create(this, R.raw.direction_sign);        G.soundClick = MediaPlayer.create(this, R.raw.menu_click);        G.soundCollect = MediaPlayer.create(this, R.raw.collect);        G.bgSound = G.soundMenu;        // show menu        CCScene scene = CCScene.node();        scene.addChild(new Menulayer(true));        director.runWithScene(scene);    }      @OverrIDe    public voID onPause()    {        if (adVIEw != null) {              adVIEw.pause();            }        super.onPause();        G.bgSound.pause();        CCDirector.sharedDirector().onPause();    }    @OverrIDe    public voID onResume()    {        super.onResume();        if (adVIEw != null) {            adVIEw.resume();          }        if( G.music ) G.bgSound.start();        CCDirector.sharedDirector().onResume();    }    @OverrIDe    public voID onDestroy()    {        // Destroy the AdVIEw.        if (adVIEw != null) {          adVIEw.destroy();        }        super.onDestroy();        G.bgSound.pause();        CCDirector.sharedDirector().end();    }    @OverrIDe    public boolean onKeyDown(int keyCode, KeyEvent event)    {        if( keyCode == KeyEvent.KEYCODE_BACK )        {            CCDirector.sharedDirector().onKeyDown(event);            return true;        }        return super.onKeyDown(keyCode, event);    }    public voID showInterstitialAds()    {        runOnUiThread(new Runnable() {            public voID run() {                 AdRequest interstitialAdRequest = new AdRequest.Builder().build();                 interstitialAd.loadAd(interstitialAdRequest);            }        });    }}

解决方法:

只有当特定应用程序从Playstore暂停时才会出现问题.也许您可以尝试更改包名称以及新的Admob ID.由于符合性,特定的admob ID也有可能被暂停.

总结

以上是内存溢出为你收集整理的java – Admob广告服务器无法填充 – 无法加载广告:3全部内容,希望文章能够帮你解决java – Admob广告服务器无法填充 – 无法加载广告:3所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1099916.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存