我创建了一个带有奖励视频广告的应用。当我点击按钮时,广告没有被加载。我曾尝试测试广告单元ID和我的admob ID,但均无济于事。每当我点击按钮时,它就会显示“广告服务器未填充。无法加载广告:3” 我不知道该怎么办。
MobileAds.initialize(getApplicationContext(),"ca-app-pub-4786107620829013~6803627405");
mad = MobileAds.getRewardedVideoAdInstance(this);
mad.setRewardedVideoAdListener(this);
mad.loadAd("ca-app-pub-xxxxxxxxxxx", new AdRequest.Builder().build());
public void Clicked(View view) {
if (mad.isLoaded())
{
mad.show();
}
}
@Override
public void onRewardedVideoAdLoaded() {
Toast.makeText(this, "Video loaded", Toast.LENGTH_SHORT).show();
}
@Override
public void onRewardedVideoAdOpened() {
Toast.makeText(this, "Video Opened", Toast.LENGTH_SHORT).show();
}
@Override
public void onRewardedVideoStarted() {
Toast.makeText(this, "Video Started", Toast.LENGTH_SHORT).show();
}
@Override
public void onRewardedVideoAdClosed() {
}
@Override
public void onRewarded(RewardItem rewardItem) {
}
@Override
public void onRewardedVideoAdLeftApplication() {
}
@Override
public void onRewardedVideoAdFailedToLoad(int i) {
Toast.makeText(this, "Fail", Toast.LENGTH_SHORT).show();
}
@Override
public void onRewardedVideoCompleted() {
Toast.makeText(this, "Complete Video", Toast.LENGTH_SHORT).show();
}