gpt4 book ai didi

android - 无法从 admob 加载奖励视频

转载 作者:太空狗 更新时间:2023-10-29 14:39:18 26 4
gpt4 key购买 nike

我对 admob 奖励视频有疑问。我从这里开始执行所有步骤:

https://developers.google.com/admob/android/quick-start?hl=es-419#import_the_mobile_ads_sdk https://developers.google.com/admob/android/rewarded-video?hl=es-419

但是当我运行该应用程序时,它说视频无法加载。我不明白这个问题,它适用于测试广告。

主要 Activity :

public class MainActivity extends AppCompatActivity implements RewardedVideoAdListener {

Button boton;

private RewardedVideoAd mRewardedVideoAd;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

boton = (Button)findViewById(R.id.boton);

// Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713
MobileAds.initialize(this, "ca-app-pub-7147850182235133~6727239853");

// Use an activity context to get the rewarded video instance.
mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this);
mRewardedVideoAd.setRewardedVideoAdListener(this);

loadRewardedVideoAd();
}

private void loadRewardedVideoAd() {
mRewardedVideoAd.loadAd("ca-app-pub-7147850182235133/4302033289",
new AdRequest.Builder().build());
}

@Override
public void onRewarded(RewardItem reward) {
Toast.makeText(this, "onRewarded! currency: " + reward.getType() + " amount: " +
reward.getAmount(), Toast.LENGTH_SHORT).show();
// Reward the user.
}

@Override
public void onRewardedVideoAdLeftApplication() {
Toast.makeText(this, "onRewardedVideoAdLeftApplication",
Toast.LENGTH_SHORT).show();
}

@Override
public void onRewardedVideoAdClosed() {
Toast.makeText(this, "onRewardedVideoAdClosed", Toast.LENGTH_SHORT).show();
}

@Override
public void onRewardedVideoAdFailedToLoad(int errorCode) {
Toast.makeText(this, "onRewardedVideoAdFailedToLoad", Toast.LENGTH_SHORT).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();
}

public void boton(View view){
if (mRewardedVideoAd.isLoaded()) {
mRewardedVideoAd.show();
}
}

最佳答案

广告可能无法正常显示的原因有多种,

  1. 确保您的付款详细信息正确无误。这可能需要大约一天才能完全活跃,直到那时 admob 不会为您提供任何广告。

  2. 尝试故障排除,网址为 this link ! .确保每个问题都清楚,然后回答。

希望这有助于...

关于android - 无法从 admob 加载奖励视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51092515/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com