3

i have problems with the admob rewarded videos. i followed all the steps from here:

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

But when i run the app it said video fails to load. I don´t understand the problem, it works fine with the test ads.

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();
    }
}

}

Zekirak
  • 191
  • 6

1 Answers1

0

There can be multiple reasons that ads might not show up properly,

  1. Make sure that your payment details are correct.This might take about a day to fully active until then admob wont provide you with any ads.

  2. Try troubleshooting available at this link! .Make sure that every questions are clear and then answer.

Hope this helps...

Tupio
  • 432
  • 7
  • 19