android – Admob Rewarded ads without button-ThrowExceptions

Exception or error:

So my problem is actually pretty simple. I have a Rewardable admob adview, but it is triggered right now in a onclick method. How can I first some how load the Rewardvideoad and then display it without an onclick method ?

my oncreate method:

protected void onCreate(Bundle savedInstanceState) {

        weekname = getIntent().getExtras().getString("week");
        score = getIntent().getExtras().getString("score");
        username = getIntent().getExtras().getString("username");

        button4 = findViewById(;
        button4.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                if (mRewardedVideoAd.isLoaded()) {

        MobileAds.initialize(this, "ca-app-pub-3940256099942544~3347511713");
        mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this);


private void loadRewardedVideoAd() {
            new AdRequest.Builder().build());

Please help,


How to solve:

This is not allowed to show the rewarded ad without opt-in.

Before displaying a rewarded ad to users, you must present the user
with an explicit choice to view rewarded ad content in exchange for a
reward. Rewarded ads must always be an opt-in experience.

Leave a Reply

Your email address will not be published. Required fields are marked *