我对获得奖励的视频有疑问。我从这里开始执行所有步骤:
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
但是当我运行该应用程序时,它说视频无法加载。我不明白这个问题,它可以与测试广告一起很好地工作。
MainActivity:
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();
}
}
}
答案 0 :(得分:0)
广告可能无法正常显示的原因有多种,
确保您的付款详细信息正确无误,这可能需要 大约一天才能完全活跃,直到admob不会为您提供 任何广告。
尝试通过this link进行故障排除!确保每个问题都清楚,然后回答。
希望这对您有帮助...