我创建了Admob视频奖励广告。我的admob帐户很旧,并且在另一个应用程序中成功显示了一个插页式广告。但是,我刚刚在admob中添加了一个新应用,并创建了一个admob视频。该视频显示良好,带有提供的admob测试ID。但是,当我使用真实的视频奖励ID时,广告加载失败。为此,我已添加了测试设备ID。
有什么我想念的吗?
这是我的代码,可以很好地加载测试广告ID,但不是真正的广告ID:
import com.google.android.gms.ads.reward.RewardItem;
import com.google.android.gms.ads.reward.RewardedVideoAd;
import com.google.android.gms.ads.reward.RewardedVideoAdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.MobileAds;
private RewardedVideoAd mRewardedVideoAd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
waitingDialog = new SpotsDialog(MainActivity.this);
MobileAds.initialize(this, "my_App_ID");
// Use an activity context to get the rewarded video instance.
mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this);
mRewardedVideoAd.setRewardedVideoAdListener(this);
loadRewardedVideoAd();
}
private void loadRewardedVideoAd() {
mRewardedVideoAd.loadAd("REAL_REAWARDED_VIDEO_ID",
new AdRequest.Builder().addTestDevice("MY_DEVICE_ID").build());
}
public void arabicSearchActivity (View view){
if (mRewardedVideoAd.isLoaded()) {
mRewardedVideoAd.show();
}else {
Toast.makeText(this, "Slow Internet, Please Click Again", Toast.LENGTH_SHORT).show();
loadRewardedVideoAd();
}
}
@Override
protected void onStop() {
if (waitingDialog!=null&&waitingDialog.isShowing())
waitingDialog.dismiss();
super.onStop();
}
@Override
public void onResume() {
mRewardedVideoAd.resume(this);
super.onResume();
}
@Override
public void onPause() {
mRewardedVideoAd.pause(this);
super.onPause();
}
@Override
public void onDestroy() {
mRewardedVideoAd.destroy(this);
super.onDestroy();
}
@Override
public void onRewarded(RewardItem reward) {
Toast.makeText(this, "onRewarded! currency: " + reward.getType() + " amount: " +
reward.getAmount(), Toast.LENGTH_SHORT).show();
// Reward the user.
startActivity(new Intent(MainActivity.this, SearchArabic.class));
}
@Override
public void onRewardedVideoAdLeftApplication() {
Toast.makeText(this, "onRewardedVideoAdLeftApplication",
Toast.LENGTH_SHORT).show();
}
@Override
public void onRewardedVideoAdClosed() {
Toast.makeText(this, "onRewardedVideoAdClosed", Toast.LENGTH_SHORT).show();
loadRewardedVideoAd();
}
@Override
public void onRewardedVideoAdFailedToLoad(int errorCode) {
Toast.makeText(this, "Please Check Internet Connections", Toast.LENGTH_LONG).show();
}
@Override
public void onRewardedVideoAdLoaded() {
Toast.makeText(this, "onRewardedVideoAdLoaded", Toast.LENGTH_SHORT).show();
}
@Override
public void onRewardedVideoAdOpened() {
Toast.makeText(this, "onRewardedVideoAdOpened", Toast.LENGTH_SHORT).show();
}
@Override
public void onRewardedVideoStarted() {
Toast.makeText(this, "onRewardedVideoStarted", Toast.LENGTH_SHORT).show();
}
@Override
public void onRewardedVideoCompleted() {
Toast.makeText(this, "onRewardedVideoCompleted", Toast.LENGTH_SHORT).show();
}
答案 0 :(得分:0)
您剩下的没有什么特别的。
当您将新应用添加到AdMob控制台时,该应用会在数据库中重新注册。意味着,就其算法而言,您的应用是新的,还不够有名。为了证明这一点,它需要从应用程序中获取少量(大约1k-3k)广告展示请求,以验证该应用程序正在生成实时印象,即它是否已被真实用户使用[这只是现实生活示例来说明]。
关键是,您的应用必须为广告资源(广告分配区域)生成一些实时印象,以返回要在应用中展示的广告。当您有大约(最大)5k(最少1k)广告请求时。它将开始展示广告。
答案 1 :(得分:0)
要确保
您必须下载并安装的第三个最重要的 在Play商店中找到您的应用,然后检查其是否正常运行。
注意:对于新广告或应用,您必须等待1-2个小时。.....就这样...