AdMob Rewarded Video – Mobile Ads Garage #7

AdMob Rewarded Video – Mobile Ads Garage #7


[MUSIC PLAYING] Hey, hey, everybody. I’m Andrew Brogdon, and welcome
back to the Mobile Ads Garage. Today, with the help of my
partner, Gary, the graphics guy, we’re going to talk about
rewarded video, a full screen video format from AdMob
that can help you monetize while increasing
engagement with your users. We’ll have screencasts and talk
implementation, but first– well, yeah, yeah, with
Katie– super nice engineer, by the way– that covered reward video,
but only through mediation. But now, AdMob has launched
its own rewarded video demand. That means you can get
rewarded video ads right from Google’s advertisers
with no mediation or third-party SDKs required. Well, yeah. Dude, I had a baby. I was in the room. Do you know what it’s like to
chase a two-foot tall version of me around a house? All right, I’m going to get
back to talking to YouTube now. If you haven’t used it
before, rewarded video is a full screen ad format
that gives users the option to watch a video in exchange
for something, usually an in-game reward. Because users have
the power of choice, they don’t have to see ads
they’re not interested in. And the ads they do see
are presented in full. That dynamic allows publishers
to build monetization into the mechanics
of their games, offering different paths
within an adventure or items that affect game play. And that’s key. We’ve seen publishers who, after
integrating rewarded video, saw an increase of overall user
engagement and long-term value. All right, so that’s
the what and the why. Let’s get to our screencast
and implement rewarded video in Android Studio. OK, so I’ve got a real
basic Android app here. It’s just got a button
to display an ad along with a text view that’s going to
keep a log of events as we go. And I’m just to wired up
to load an ad and show it. So how do I do that? With these steps. So first, I’ll make sure
that the SDK’s initialized. Then I’ll set up the
listener that will keep me wired into the ad lifecycle. And after that, it’s
just loading the ad, showing it, and
making sure I catch the rewards that come out. So step one, initialize the SDK. Normally for these
videos, I start with the SDK already imported. But I wanted to be sure to
mention that Google recently started distributing the
SDK via Maven and not in the SDK manager. So I’m here in my apps
project level gradle file. And you can see this
Google line here. That’s new for Android Studio
3.0, which will, hopefully, be released before this
video makes it to YouTube. If you’re using version
two, though, you could just add the Maven
repo manually like this. Here we go. And the URL’s just
maven.google.com. And this way, studio
will know which repo to use to go get the SDK. So once that’s done, you can go
into the app level gradle file and add the mobile ads SDK
the same way you normally would before. It’s just com.google.android.gms
and then Play Services ads. And always make sure you’re
using the latest version. Right now, it’s 11.4.2. All right, so with
that in place, let’s head into my
activity file and make the call to initialize the SDK. You only need to do this once
in your app per execution. Although, if you do it more
than once, it’s not a big deal. And I’m just going to call
the static method, initialize. And I’m giving it a
context and an app ID. Since this is just a test
app I’m messing around with and not a real
published app, I’m actually using the App ID from
our quickstart guide, which you can use as well if
you’re just playing around with the SDK. So don’t publish with
it, of course, but it’s fun for testing if you’re just
playing around with the SDK and it’s API. All right, so step one, done. Let’s move on to the listener. First, I’m going to come
up here and add to my class the rewarded video ad listener
interface so my activity can serve as the
listener for the ads and get callbacks for
events in the ad life cycle. Then I’m going to use Android
Studio’s implement methods right there to do
some code generation. So it’s going to stub
out these methods. And let’s talk about them. So I’ve got the big seven here. Number one is the
ad loaded callback. This gets fired when an
ad loads successfully. Then I’ve got ad opened. That will get called when an
ad opens and covers the screen. Video started, of course,
for when the playback starts. Ad closed for when
the ad is closed, and you’ve returned
to your app’s UI. Then on rewarded, this is
the reward item callback– we’ll get back to this
toward the end in step five. Ad left application,
this is called when focus leaves your app
to go to the Play Store or destination URL. And then ad failed
to load, which has an error code
to let you know that a load add call failed. OK, so I’m just going to drop
some log statements in here, and I’m going to leave the
reward callback blank for now. Like I said, we’ll come back
to that one in just a second. And I’m just going to
put some text in here, so I can see it
in that text view. OK, now I’m going
to scroll back up and make a member
variable that’s going to hold a reference to
the rewarded video ad singleton. And here, I’m going to
retrieve that reference using a static method in
the mobile ads class. Unlike all the other
formats, rewarded video uses the singleton pattern. So rather than instantiating
individual objects yourself for each ad, you just need to
grab a reference in the SDK and hang onto it. All your calls are going to
go through as one object. And now that I have
that reference, I can set this activity as the
listener for rewarded video ads. And I’m wired up. Cool. So that’s two steps down. Time to load an ad. Video ads are big,
so it’s a good idea to load them well in advance
and make sure they’re ready. I’m going to load mine as soon
as this activity’s created by calling load ad. And I’m going to give it an ad
unit and a new request object. And that’s the same
ad request class used for all the other formats, so
the usual methods for options and targeting and stuff, those
are right there in place. And the ad unit I’m using
here is a test unit. It will always return
test ads, which makes it safe to use while developing. You can find that same
ad unit right here in our rewarded video guide. And you’re welcome to
use it in your apps. If you’re just starting
out, you haven’t registered an ad unit of your own, or
any time you’re debugging and just want to make
sure you get test ads, you’re welcome to use this one. All right. So if I launch my app now,
I should see it in ad loads. And there it is. Cool. All right, on to step
four, showing the ad. First, let me just slip
a little line in here to enable the button
when it loads. I’m going to put that into
the on ad loaded callback, so my button will be lit. Perfect. Now I’m going to go up to the
click listener for the button. And I’m going to disable
it when it’s clicked, because we’ll be showing an ad. And then I’m going to check
the page is loaded method to make sure I’ve got an
ad ready, and then show. Now, technically,
I don’t really need to do the is loaded call
because I know, for a fact, I’ve got an ad. But it’s a good practice to
get in the habit of doing, and so I do recommend it. All right, let’s run it again. And I’ve got an ad loaded. Let’s show it. And there’s my test ad. All right. So one step left, and that’s
to reward the user when they watch a video completely. For that, I’m going to pop down
to the on rewarded callback. So this is fired when a user
watches a video to completion. And it’s how your app knows
to distribute a reward. And it comes with this
little reward item parameter that includes the
amount and type of reward. And those will have the data
that you put into the AdMob UI when you make your ad units. So depending on the
ad unit, you might want to have one that’s
10 coins, for example, and another one that
rewards 37 sheep. Whatever you put in, you’re
going to get out here. They come in the form
of a number and a string description. So I’m just going
to log the reward to show that it
happened, but you can do pretty much
whatever you want with this data in your own app. OK, so let’s run one last time. There’s my ad. So I’ll go ahead and click show. And we just need to
wait for this to finish. Let me quickly say,
by the way, that when they asked me to record
the video for the test ad, I didn’t think about the
fact that people are going to have to look at it,
like, 50 times while testing the rewarded code. So if you get to that 50th
go round and you’re thinking, dear lord, if I have to look
at this guy one more time– don’t feel bad. I completely understand. The good news is
we got the reward. We got our 10 coins, though,
so this implementation’s done. That’s all five
steps– initialize, set up the listener,
load, show, and reward. All right, so that’s rewarded
video in Android Studio. Actually, that’s kind of true. Rewarded ads are a
lot like interstitials in that you load them in
advance and then show them at a pause in the
flow of your app. In fact, a rewarded ad is
really just a video interstitial with an extra callback
to reward the user. So with Android down, let’s see
how rewarded ads work in iOS. For that, we’re going
to head in to Xcode. All right, here’s my iOS app
running on the simulator. I’ve got a button up
top to show an ad, and a log that will show
events as they come in. Now, how am I going
to get this wired up to show a rewarded video ad? Well, here are the
steps, and they’re almost identical to
the ones for Android. First, I’ll initialize
the SDK and set up a delegate that
will get callbacks for the events in
the ad lifecycle. And once that’s done, it’s
just load, show, and reward. So first up,
initialising the SDK. Here’s my AppDelegate. And I’ve already
got the SDK building into this app via CocoaPods,
so I can import it right here. And then I’ll hop down and call
the class method for configure on GADMobileAds. And I need to pass
that my application ID. There we go. Since this is just a sample app
that’s not really registered, I’m using the sample app ID
from our Get Started Guide on the AdMob developer site. If you’re just messing
around with the SDK, testing things out, you can use
this as well in your own test apps. Cool. So that’s step one. Now, let’s get the
delegate going. Here I am in my view controller. And the first thing I’m going
to do is import the SDK. Then I’ll make a
property that’ll store a reference to the
rewarded video singleton. So unlike the other
formats, rewarded video uses the singleton
pattern in iOS. So instead of creating your
own object for each ad, you just grab a reference to
the shared instance, which you’ll see right
here, and then you use that to make all your calls. And that’s all I’m
doing in this step. So next, I’m going to
assign this view controller as the delegate for that
rewarded video singleton. And Xcode’s going to
yell at me, correctly, because my view controller
doesn’t implement the delegate protocol. So I’ll pop up here, and
I’ll add that protocol. There we go. And I’m going to get a
new error, because I don’t implement the required methods. Now, XCode 9 has
this new thing where it will stub out the
protocol for you, but it only does the
required methods. And I want all of
them, so I’m going to do it through the magic
of cutting and pasting. This is like in a
cooking show where they make a roast
turkey that has to go in the oven for three hours. And they put it in,
and then, like, I just happen to have this other
turkey I put in three hours ago. And they pull out
the finished one. So you can get these
method signatures from our reference docs. They also auto-complete if
you start typing them in. Let me go down a list, though,
and I’ll cover each one. So, first we have
video ad did open. This is called when an ad
opens and covers the UI. Then we have ad did close. It’s the opposite–
when an ad closes and you go back to your app. This is ad did receive. This is the ad loaded
callback, basically, so this is where you get an ad. Ad did start playing, that’s
for when video playback begins. Ad will leave
application, that’s when somebody clicks
through on the ad and goes to the app
store or destination URL, YOU get that one. This is did fail to
load, which is called when an ad fails to load. You get an error code
explaining the problem. And finally, did reward
user with reward– and that’s the reward callback. We’ll cover that in step five. Cool. So the view controller
is now set up as the delegate for
rewarded video ads. That’s all the methods. Let’s load an ad. I’m just going to
call the load method. First, I’ll pass it
a GAD request object. And this is the same request
class used for other formats, so the same options and
targeting methods are there. And I’m also going to
give it an ad unit. And since I’m just
messing around here and need to use test ads, I’m
actually using the ad unit from our rewarded video
guide– which you can use too. It’s specially configured
to always return test ads. So you can mess around with
it, load ads, tap on them, click on them, whatever
you’re going to do, and you don’t have
to worry about it. Cool. So if I build this, I
should see an ad get loaded. And there it is. Cool. All right, so I’ve got an ad. Let’s show it. First up, my button
for showing an ad starts off disabled,
so I’m going to need to enable it in the
did receive ad delegate method. This gets called
when an ad loads. And so I’ll just enable that
button, so I can press it. Now, I’m going to scroll
back up to the action method for that button. And first, I’ll disable it. Since we’re going to show, we
want to disable the button. And then I’m going to
check the is ready property and call present. The is ready check here isn’t
really necessary, since I know for a fact that I
just loaded an ad, but it’s a good idea
to call it anyway. It doesn’t take much time. It’s a good thing to
check on each show. All right. So if I build and run this,
let’s see what happens. All right, there’s my ad. And we click the button,
and there’s our test ad. Cool. So, just one step
left, and that’s to reward the user when they
watch a video to completion. And that’s done in a did reward
user with reward delegate method. This method is invoked
whenever a video is watched to completion
and the user needs to be given their award. So I’m just going
to log this info, but your app or game can
do pretty much whatever you want with the reward data. It arrives in a GAD
ad reward object, which has two properties,
amount and type, for the reward. It’s going to be set to whatever
you entered when you created your ad unit in the AdMob UI. In this case, I
think it’s 10 coins, but it’s literally just
a number and a string. It can be almost
anything you want. All right. So now when I run this– get the simulator back up. And I’ll click show ad. And we just need to
watch this to completion, and that reward
callback will be fired. So we’re watching a video
of me in a video of me. I’m basically incepting. There we go. Cool. So if I close this,
there’s my reward callback just before the
I close callback. All right, so that’s
all five steps. Rewarded video ads
are finished for iOS. Job done. And that’s rewarded video. For links to our guides for
Android, iOS, and Unity, plus samples on GitHub,
check the description below. We’ve also got a link down
there for our support forum if you run into any problems. And as always, if you’ve got
a question about this episode or an idea for something
you’d like us to cover, leave a comment below, and Gary
and I will see you next time. [MUSIC PLAYING]

65 comments

  • first lik first comment 6th view

  • Oh man I wait for this video years and years

  • I've just implemented interstitial ads which also sometime contains videos. Is there a difference regarding being able to close a video ad?

  • Thank you

  • any body other got this error " Fail to instantiate adapter com.google.DummyAdapter"

  • What's the difference with getting "com.google.firebase:firebase-ads:11.4.2"?

  • hey, thanks for another nice video from you.
    I am still wondering which Theme you are using for Android Studio.
    Default Dracula Theme isn't my favourite yet.

  • Please any one! i have a problem in my admob account… where should i log this issue to admob…
    my admob did not create ids of interstitial and banner…

  • Hi,
    Thanks for this awesome tutorial. I have implemented the same, rewarded videos are also shown, but after user watch full video, I am releasing reward points to user but not getting money for which I have released reward points to user. Getting money only when user watch whole video, then click on ads. I need a solution to monetize when user watch full video. CTR shouldn't compulsory to monetize money. Can I get money when user watch full rewarded video?

  • Is it possible to load ads in one activity and then show them from other activity? I would like to load them in mainactivity and then show them from any other place in application.

  • I don't mind listening to this guy for 13 seconds while I test the ad feature. What really annoys me is the other test ad for "Creative Preview" which steals 51 seconds of my time every time I want to receive an onRewarded callback.

  • Hey guys! Don't you have any issue these days with Video Rewarded Ads? Today my banner ad shows a "AdMob Test Smart Banner" with slide instead of Congrats or Youtube testing ads (but still working) and the Video Rewarded Ad doesn't load with the errors "Fail to instantiate adapter com.google.DummyAdapter" and "Failed to load ad: 3".

  • 50 to 60 reaward vedio getting 0.02$ in India,so waste

  • Where is native ads from admob ?

  • I used tested ca pub code ad it worked but when I used my own ca pub ad. It shows continuously rewarded video failed to load. Pls say me some solution…

  • why my video ad is not loading can anyone help me
    here is my code it always give me
    "Ad failed to load"

    package com.tech.myapplication;

    import android.os.Bundle;
    import android.support.v7.app.AppCompatActivity;
    import android.view.View;
    import android.widget.Toast;

    import com.google.android.gms.ads.AdRequest;
    import com.google.android.gms.ads.MobileAds;
    import com.google.android.gms.ads.reward.RewardItem;
    import com.google.android.gms.ads.reward.RewardedVideoAd;
    import com.google.android.gms.ads.reward.RewardedVideoAdListener;

    public class MainActivity extends AppCompatActivity implements RewardedVideoAdListener {
    private RewardedVideoAd mAd;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    MobileAds.initialize(this,"ca-app-pub-3940256099942544~3347511713");

    mAd = MobileAds.getRewardedVideoAdInstance(this);
    mAd.setRewardedVideoAdListener(this);
    loadAdfunction();

    }

    private void loadAdfunction() {
    Toast.makeText(this,"load function",Toast.LENGTH_SHORT).show();
    AdRequest adRequest = new AdRequest.Builder().build();
    mAd.loadAd("ca-app-pub-3940256099942544/5224354917", adRequest);
    }

    @Override
    public void onRewardedVideoAdLoaded() {
    Toast.makeText(this," ad loaded successfully",Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRewardedVideoAdOpened() {

    }

    @Override
    public void onRewardedVideoStarted() {

    }

    @Override
    public void onRewardedVideoAdClosed() {

    }

    @Override
    public void onRewarded(RewardItem rewardItem) {

    }

    @Override
    public void onRewardedVideoAdLeftApplication() {

    }

    @Override
    public void onRewardedVideoAdFailedToLoad(int i) {
    Toast.makeText(this,"Ad failed to load",Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onResume() {
    mAd.resume(this);
    super.onResume();
    }

    @Override
    public void onPause() {
    mAd.pause(this);
    super.onPause();
    }

    @Override
    public void onDestroy() {
    mAd.destroy(this);
    super.onDestroy();
    }

    public void show(View view) {
    if (mAd.isLoaded())
    {
    mAd.show();
    }
    else
    { Toast.makeText(this,"Button clicked ad not loaded",Toast.LENGTH_SHORT).show();
    loadAdfunction();
    }

    }
    }

    my graddle file (app)

    apply plugin: 'com.android.application'

    android {
    compileSdkVersion 26
    defaultConfig {
    applicationId "com.tech.myapplication"
    minSdkVersion 16
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
    release {
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    }
    }

    dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile 'com.google.android.gms:play-services-ads:11.8.0'
    }

  • when i used my admob account ad id that time only getting failed to load ad massage what can i do???
    please help me..

  • I did the same as you instructed, but my Ads are not loaded and didn't show , I can share my Code with you. Please check what am I doing wrong. I spent 2 days upon this bloody simple task, but didn't get the positive result. please help.

    IDs are put in strings
    <string name="temp_googleRewardedAppID" translatable="false">ca-app-pub-3940256099942544~3347511713</string>
    <string name="temp_rewardedID" translatable="false">ca-app-pub-3940256099942544/5224354917</string>

    Gradle Entires

    //GOOGLE REWARDED ADS
    allprojects {
    repositories {
    jcenter()
    maven {
    url "https://maven.google.com"
    }
    }
    }

    and in dependencies
    //GOOGLE REWARDED ADS
    compile 'com.google.android.gms:play-services-ads:11.8.0'

    MainPage Code is

    public class MainActivity extends AppCompatActivity implements RewardedVideoAdListener {
    private RewardedVideoAd rewardedVideoAd;
    private TextView statusText;
    private Button loadButton, showButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    MobileAds.initialize(this, this.getString(R.string.temp_googleRewardedAppID));
    rewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this);
    rewardedVideoAd.setRewardedVideoAdListener(this);

    loadRewardedAd();

    initControls();
    }

    private void initControls() {
    statusText = (TextView) findViewById(R.id.statusTxt);
    loadButton = (Button) findViewById(R.id.loadBtn);
    loadButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    loadRewardedAd();
    }
    });
    showButton = (Button) findViewById(R.id.showBtn);
    showButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    showRewardedAd();
    }
    });
    }

    private void loadRewardedAd() {
    if (!rewardedVideoAd.isLoaded()) {
    rewardedVideoAd.loadAd(this.getString(R.string.temp_rewardedID), new AdRequest.Builder().build());
    /*AdRequest request = new AdRequest.Builder()
    .addTestDevice("33BE2250B43518CCDA7DE426D04EE231") // An example device ID
    .build();

    rewardedVideoAd.loadAd(this.getString(R.string.temp_rewardedID), request);*/
    }
    }

    private void showRewardedAd() {
    if (rewardedVideoAd.isLoaded()) {
    rewardedVideoAd.show();
    }
    }

    @Override
    public void onRewardedVideoAdLoaded() {
    statusText.setText("Ad has been loaded");
    }

    @Override
    public void onRewardedVideoAdOpened() {

    }

    @Override
    public void onRewardedVideoStarted() {

    }

    @Override
    public void onRewardedVideoAdClosed() {
    loadRewardedAd();
    statusText.setText("Ad has been Closed");
    }

    @Override
    public void onRewarded(RewardItem rewardItem) {
    Toast.makeText(this, "User has been Rewarded : " + rewardItem.getAmount() * 10, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRewardedVideoAdLeftApplication() {

    }

    @Override
    public void onRewardedVideoAdFailedToLoad(int i) {
    statusText.setText("Failed to Load Ad");
    }

    @Override
    protected void onPause() {
    rewardedVideoAd.pause(this);
    super.onPause();
    }

    @Override
    protected void onResume() {
    rewardedVideoAd.resume(this);
    super.onResume();
    }

    @Override
    protected void onDestroy() {
    rewardedVideoAd.destroy(this);
    super.onDestroy();
    }
    }

  • demonyes chaos theory

    Need to test it in my constract 2 game engine .
    I do haw an acound in admob

  • please guidance, if I make my own application and include video reward ads, can I watch alone or have to be the same with others? and is it okay to download after the ads finish?

  • Can i use these rewarded video banner ad and interstitial ads on a single app?

  • Hi there..,
    I'm getting ad failed to be loaded every time when i run the app…
    can u help me with this..
    i followed all of your code..

  • cant reward users with xamarin ??!

  • Manish Whatsapp Stutus

    how to contact admob official???😢😢😢😢😢

  • romantic status world

    bro where can we see the earnings of rewarded video ads pls tell me bro

  • ios starts at @8:45

  • im using spritekit scenes – does this still need to go in the view controller?

  • How can I check if the user got rewarded, even if he uninstalled&re-installed the app?
    Is there an API for this? Maybe even know when was the last time he got rewarded? Or even history of rewards?
    For example, I'd like to reward the user of watching a video, by removing banners.

  • GT Technical Hindi

    how to admob non skip video reward ads ??? yes and no

  • Hi, in game with test ads i notice rewarded videos can be shown all the time! but when using real ad unit ID in game how often can a rewarded video be shown? is there a set amount of time an ad can be viewed and how often? thank you

  • I read admob policy but there is not info about these things , Please you tell me about them.
    1. How many reward videos let watch one user?
    2. How many banner ad can be on screen?
    3. How many time should between two interstital videos?

  • How much do you get paid for 1 video veiw?

  • Users clicking to watch ads, and go to websites, is this cpc or Cpe?

  • How much do developer get paid for clicks?

  • What are the rates per rewarded video? Is it based on number of active daily users? Is there a general formula to use to calculate what a rough income would be? It’s critical to know before making the decision to develop.

  • Good day.
    Am creating an app, and would like to monetize my app by using rewarded videos, I would like to know how much I would get paid for every video my users watch. Also, watching videos and visiting website from my app, is this referred to as cpc ?

  • Me it crash…

  • Hello,
    I am new in AdMob. Do you have any rules like one user can't watch more than 10 ads per day or something like that?

  • Can we use rewarded video ads in non gaming apps please reply fast

  • Can I single ads units( Bannner,interstitial ) in multiple apps . Or Make the mulitple ads units ( Bannner,interstitial ) for multiple apps .Please give reply.

  • I Search a lot about it but failed than when I run reward video ad it shows error 3 In #onRewardedVideoAdFailedToLoad please help.
    public class Main2Activity extends AppCompatActivity implements RewardedVideoAdListener {
    private RewardedVideoAd mRewardedVideoAd;
    Button button;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main2);
    button=findViewById(R.id.rewardid);

    MobileAds.initialize(this, "ca-app-pub-3940256099942544/5224354917");
    mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this);
    mRewardedVideoAd.setRewardedVideoAdListener(this);
    loadRewardedVideoAd();

    button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    if(mRewardedVideoAd.isLoaded())
    {
    mRewardedVideoAd.show();
    }

    }
    });
    }

    private void loadRewardedVideoAd() {

    mRewardedVideoAd.loadAd("ca-app-pub-3940256099942544/5224354917",
    new AdRequest.Builder().build());
    }

    @Override
    protected void onDestroy() {
    mRewardedVideoAd.destroy(this);
    super.onDestroy();
    }

    @Override
    protected void onPause() {
    mRewardedVideoAd.pause(this);
    super.onPause();
    }

    @Override
    protected void onPostResume() {
    mRewardedVideoAd.resume(this);
    super.onPostResume();
    }

    @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 onRewardedVideoAdClosed() {
    Toast.makeText(this, "onRewardedVideoAdClosed", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRewarded(RewardItem rewardItem) {
    Toast.makeText(this, "onRewarded", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRewardedVideoAdLeftApplication() {

    }

    @Override
    public void onRewardedVideoAdFailedToLoad(int i) {
    //Toast.makeText(this, "onRewardedVideoAdFailedToLoad", Toast.LENGTH_SHORT).show();
    Toast.makeText(this, i+"", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRewardedVideoCompleted() {
    Toast.makeText(this, "onRewardedVideoCompleted", Toast.LENGTH_SHORT).show();
    }
    }

  • Technically Non-Tech

    Im getting error code: 3 even in case of test id. Doesnt AdMob even have any test ads in store for us? How are we supposed to test the app then?

  • Great, all android tutorials should be clear and simple like this one!

  • hello how can add button and mlog in my manifest xml file am stack at that point especially mlog

  • on reward ad failed to load

  • nice channel

  • Thank you so much
    a lot of completed ad views have no revenue.

    how can i know which view had revenue or not?

  • my Rewarded Ad unit Id is not working .

  • I trying your test Ad unit Id that was proper Working at my Android app.

  • So please Help me.

  • Hello, thank you.
    Does Admob follow a decreasing value after admitting the admob?

    For example, 5 coins won by the user fell to 4, admob follow and know this?

    Or does Admob advertise the tokens after the ad is viewed?

    I want to save (amountPrize) with sharedprefferens and reduce it as user uses. Then I want to show the advertisement again.
    Is it a problem? in terms of policy.

  • Studio Scientific Facts

    Is it legal to use RewardedVideo without giving any reward to the user.. i am desiging an app which does not contain any reward points

  • In test mode its working, but when i change to my real App-ID and Ad-Unit-Id. People who using my apps doesn't see ads. When i figured out, it was failed load, method "onRewardedVideoAdFailedToLoad" was called. i have follows this steps

  • I am implement rewarded video ad tested ad is working but created ad is not working y

  • Alexander Lorenson

    Always Getting Error Code: NO_FILL even when trying the sample ad unit by google

  • I am new one Mohammad aoun tell me friend how can work on admob?????

  • How to apply rewarded video to android in two different activities, independent of one another (different mini games)? Including the need to use children tags.

    Is it correct to make MobileAds.initialize in the launch of the first activity?

    And request? One static request, before initialization? For children tag using before initialization ..

    And what to do with loading the next video immediately after viewing? After all, if you do not do this each time, you have to wait a long time for the next video, and if you make loading, and the player switches to another activity, the video will remain unused and apparently it makes errors. Help me please. Thank you in advance!

  • If there's no other person in the room to banter with, DON'T BANTER.

  • good

  • Can you help me?

    Google disabled my adsense account for policy violation. But I feel that this decision was made in error. So I filled the appeal form. But after a few seconds they replied that the publisher id i gave is not valid. But i entered the correct publisher id. It was stored in my emails received from google admob.

    Now what should i do? Please help me anybody.

  • I think we need a vídeo like this but for Flutter, I am having problems to implement on my game 🙁

  • Hi, im programing a game with instertitial and video rewarded ads.

    I wanna know if there is a limit of Instertitial or videos that a single user can request per hour/day.

    I dont wanna break the policies or be catalogued as invalid activity; i searched for it but i didnt get any specific limit.

    (Sorry is i have any mistake in language)

    Greetings from argentina

  • how can i use my own ads on admob?

  • Star Fluttershy

    i followed the tutorial and for me it worked fine.

    for example this is my app: https://play.google.com/store/apps/details?id=com.StarFalls.Break

Leave a Reply

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