Search code examples
androidadmobrewardedvideoad

Android Studio - Rewarded Video Ad loaded but not shown


I tried the following code (main_activity.java)

        MobileAds.initialize(this, "ca-app-pub-3940256099942544~3347511713");
// 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-3940256099942544/5224354917",
                new AdRequest.Builder().build());

        if (mRewardedVideoAd.isLoaded()) {
            mRewardedVideoAd.show();
        }

logcat says, that the Ad is loaded but it doesn´t show up. I want to display the ad in a seperate fragment, so maybe the "(this)" is wrong?

Thank you for your help... See this reference: https://developers.google.com/admob/android/rewarded-video


Solution

  • I fixed it:

     @Override
        public void onRewardedVideoAdLoaded() {
            mRewardedVideoAd.show();
        }