Admob的没有来自广告服务器填补 - 无法加载广告:3 [英] Admob No fill from ad server - failed to load ad: 3
问题描述
我的问题是,广告不会被显示在所有在我的应用程序,测试模式或没有。我要保持这个问题,具体到测试模式,一旦我得到的工作,我会担心活广告。
发展信息
我使用Eclipse进行开发。
我已经安装广告使用谷歌游戏服务和AdMob在我的Android应用程序,如谷歌提供的在线文档描述。
我已经用addTestDevice(XXXXXXXXXXXXXXXX)加入我的设备ID,并检查了哈希设备ID的次数,以确保它是正确的。
的问题(参见下面的日志信息)
当我在我的设备上运行的应用程序,没有广告将显示在所有。发生这种情况甚至当我增加了我的设备作为试验装置。
我已经寻找高和低,转身了许多类似的问题,但我还没有找到一个答案,这个特定的问题。
LogCat中输出
10-28 13:56:41.659:I /广告(1704):启动广告请求。
10-28 13:56:42.187:I /广告(1704):从广告服务器无填充。
10-28 13:56:42.187:W /广告(1704):无法加载广告:3
10-28 13:56:42.199:W /广告(1704):没有GMSG处理发现GMSG:gmsg://mobileads.google.com/jsLoaded google.afma.Notify_dt = 1414504602197
我的活动
包bb.hoppingbird;
进口org.cocos2d.layers.CCScene;
进口org.cocos2d.nodes.CCDirector;
进口org.cocos2d.opengl.CCGLSurfaceView;
进口com.google.android.gms.ads.AdListener;
进口com.google.android.gms.ads.AdRequest;
进口com.google.android.gms.ads.AdSize;
进口com.google.android.gms.ads.AdView;
进口com.google.android.gms.ads.InterstitialAd;
进口android.app.Activity;
进口android.content.Shared preferences;
进口android.media.MediaPlayer;
进口android.os.Bundle;
进口android.support.v4.view.ViewPager.LayoutParams;
进口android.util.DisplayMetrics;
进口android.view.KeyEvent;
进口android.widget.RelativeLayout;
进口android.widget.Toast;
公共类MainActivity延伸活动{
私人CCGLSurfaceView mGLSurfaceView;
//<! - 使用谷歌播放服务SDK Admob的广告 - >
私有静态最后弦乐AD_UNIT_ID =CA-APP-酒馆xxxxxxxxxxxxxxxxxxxx;
私有静态最后弦乐AD_INTERSTITIAL_UNIT_ID =CA-APP-酒馆xxxxxxxxxxxxxxxxxxxx;
/ **的Admob的广告。 * /
私人InterstitialAd interstitialAd = NULL;
公共AD浏览报AD浏览报= NULL;
公共静态MainActivity应用;
公共无效的onCreate(包savedInstanceState)
{
应用程序=这一点;
super.onCreate(savedInstanceState);
// set视图
mGLSurfaceView =新CCGLSurfaceView(本);
//广告----------------
//创建AD浏览报
RelativeLayout的布局=新RelativeLayout的(这一点);
layout.setLayoutParams(新RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));
//<! - 广告使用谷歌播放服务SDK - >
AD浏览报=新的AD浏览报(本);
adView.setAdSize(AdSize.SMART_BANNER);
adView.setAdUnitId(AD_UNIT_ID);
// AD浏览报给它添加
RelativeLayout.LayoutParams PARAMS =新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(AD浏览报);
的setContentView(布局);
//新AdRequest
AdRequest adRequest =新AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice(0D47C6944503F0284666D16BB79BF684)
。建立();
//开始在后台加载的广告。
adView.loadAd(adRequest);
// ------------------------------------------------ -----间质性添加
//创建一个内广告。
interstitialAd =新InterstitialAd(本);
interstitialAd.setAdUnitId(AD_INTERSTITIAL_UNIT_ID);
interstitialAd.setAdListener(新AdListener(){
@覆盖
公共无效onAdLoaded(){
interstitialAd.show();
}
@覆盖
公共无效onAdFailedToLoad(INT错误code){
Toast.makeText(getApplicationContext(),插播式广告加载失败,Toast.LENGTH_SHORT).show();
}
});
//将插播式广告。
// showInterstitialAds();
// ----------------------
//组主任
CCDirector导演= CCDirector.sharedDirector();
director.attachInView(mGLSurfaceView);
director.setAnimationInterval(1/60);
//获取显示信息
DisplayMetrics displayMetrics =新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;
//获取数据
共享preferences藻= CCDirector.sharedDirector()getActivity()getShared preferences(的GameInfo,0)。。;
G.music = sp.getBoolean(音乐,真正的);
G.sound = sp.getBoolean(声音,真正的);
//创建声音
G.soundMenu = MediaPlayer.create(这一点,R.raw.menu);
G.soundMenu.setLooping(真正的);
G.soundGame = MediaPlayer.create(这一点,R.raw.game);
G.soundGame.setLooping(真正的);
G.soundCollide = MediaPlayer.create(这一点,R.raw.collide);
G.soundJump = MediaPlayer.create(这一点,R.raw.jump);
G.soundLongJump = MediaPlayer.create(这一点,R.raw.long_jump);
G.soundSpeedDown = MediaPlayer.create(这一点,R.raw.speed_down);
G.soundSpeedUp = MediaPlayer.create(这一点,R.raw.speed_up);
G.soundDirection = MediaPlayer.create(这一点,R.raw.direction_sign);
G.soundClick = MediaPlayer.create(这一点,R.raw.menu_click);
G.soundCollect = MediaPlayer.create(这一点,R.raw.collect);
G.bgSound = G.soundMenu;
//显示菜单
CCScene场景= CCScene.node();
scene.addChild(新MenuLayer(真));
director.runWithScene(场景);
}
@覆盖
公共无效的onPause()
{
如果(AD浏览报!= NULL){
adView.pause();
}
super.onPause();
G.bgSound.pause();
CCDirector.sharedDirector()的onPause()。
}
@覆盖
公共无效onResume()
{
super.onResume();
如果(AD浏览报!= NULL){
adView.resume();
}
如果(G.music)G.bgSound.start();
CCDirector.sharedDirector()onResume()。
}
@覆盖
公共无效的onDestroy()
{
//销毁AD浏览报。
如果(AD浏览报!= NULL){
adView.destroy();
}
super.onDestroy();
G.bgSound.pause();
。CCDirector.sharedDirector()()结束;
}
@覆盖
公共布尔的onkeydown(INT键code,KeyEvent的事件)
{
如果(键code == KeyEvent.KEY code_BACK)
{
CCDirector.sharedDirector()的onkeydown(事件)。
返回true;
}
返回super.onKeyDown(键code,事件);
}
公共无效showInterstitialAds()
{
runOnUiThread(新的Runnable(){
公共无效的run(){
AdRequest interstitialAdRequest =新AdRequest.Builder()建立()。
interstitialAd.loadAd(interstitialAdRequest);
}
});
}
}
这些问题来只有当特定的应用程序从playstore暂停。也许你可以尝试改变包名和,也与新Admob的Id.There是一个机会,特别是AdMob的ID,也可因柔暂停。
My issue is that ads are not being displayed at all in my app, test mode or not. I am going to keep this question specific to test mode, and once I get that working I will worry about live ads.
Development Information
I am using Eclipse for development.
I have setup ads using Google Play Services and Admob in my Android app, as described in the online documentation provided by Google.
I have added my device ID using addTestDevice("xxxxxxxxxxxxxxxx"), and have checked the hashed device ID a number of times to be sure it is correct.
The Issue (see below for log info)
When I run the application on my device, no ads are displayed at all. This happens even when I have added my device as a test device.
I have searched high and low, and turned up many similar issues, but am yet to find an answer to this specific problem.
LogCat Output
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: 3
10-28 13:56:42.199: W/Ads(1704): No GMSG handler found for GMSG: gmsg://mobileads.google.com/jsLoaded?google.afma.Notify_dt=1414504602197
My Activity
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);
}
});
}
}
The issues comes only if that particular app is suspended from playstore. Maybe you can try changing the package name and and also with new Admob Id.There is a chance that particular admob id can also be suspended due to compliances.
这篇关于Admob的没有来自广告服务器填补 - 无法加载广告:3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!