0

If a user win Puzzle Game Level than I make a Toast "You Win Play Next Level" and then I want to show rewarded video ads.

What code will be there to show Admob Rewarded Video Ads after Toast in android studio?

    if (isSolved())
        Toast.makeText(context, "You Win ! Play Next Level", Toast.LENGTH_LONG).show();
Edric
  • 24,639
  • 13
  • 81
  • 91

2 Answers2

1

You add a Toast.Callback to the Toast. Assuming that you already know how to show your admob videos:

Toast t = Toast.makeText(context, "You Win ! Play Next Level", Toast.LENGTH_LONG);
        t.addCallback(new Toast.Callback() {
            @Override
            public void onToastShown() {
                super.onToastShown();
                // show admob when toast is shown
            }
            @Override
            public void onToastHidden() {
                super.onToastHidden();
                // show admob when toast disappears
            }
            
            
        });
t.show();

Reference: https://developer.android.com/reference/android/widget/Toast.Callback

reden
  • 968
  • 7
  • 14
0

static final long SHORT_DURATION_TIMEOUT = 4000;

static final long LONG_DURATION_TIMEOUT = 7000;

These are the values of the Short & Long Text 4seconds and 7 seconds , You can Trigger your video ad after this Duration.

surya
  • 607
  • 5
  • 18