title: Android - Rewarded video ads never load again after the app is closed
body: <p>I am new to Android rewarded video ads. I tried to create an application with rewarded video ads as is explained in <a href="https://firebase.google.com/docs/admob/android/rewarded-video" rel="nofollow noreferrer">Rewarded Ads: Publishers Get Started</a></p>
  
  <p>There is a button, in the application, that allows the user to view a rewarded video. The button is enabled after the video is loaded.</p>
  
  <p>The first time I open the application everything works. I can view several video ads by pressing the button. The problem is, after I close the application, by pressing the back button, and open it again. Then, the ads never load again. I receive no messages from the RewardedVideoAdListener and I put a Toast in very function. There simply is no feedback. I should be able to view a Toast in the onRewardedVideoAdFailedToLoad, but not even that happens. It is as if the code completely fails to execute.</p>
  
  <p>As I said, I am new to Android rewarded video ads. Perhaps I am doing something wrong but I can't figure out what. I have already searched the Internet, but I can't find any answer. Some people mention problems when loading ads, but not the specific problem of ads not loading after the application is closed and opened again. I also checked this question but nobody answered:
  <a href="https://stackoverflow.com/questions/41962662/android-reward-video-ads-not-loading-after-loading-once">Question on StackOverflow</a></p>
  
  <p>I ran the app in different phones and I always find this problem.</p>
  
  <p>Can anyone help me?</p>
  
  <p>Sorry for my English. I am not a native speaker.</p>
  
  <p>Here is the code in my main activity:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity implements RewardedVideoAdListener {
  
      private Button mWatchButton;
      private TextView mRewardLabel;
      private RewardedVideoAd mAd;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
  
          mWatchButton = (Button)findViewById(R.id.btn_watch);
  
          mAd = MobileAds.getRewardedVideoAdInstance(this);
          mAd.setRewardedVideoAdListener(this);
          loadAd();
  
          mWatchButton.setEnabled(false);
          mWatchButton.setOnClickListener(new View.OnClickListener(){
                  @Override
                  public void onClick(View v) {
                      if(mAd.isLoaded()){
                          mAd.show();
                      }
                  }
              }
          );
  
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
          FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
          fab.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                          .setAction("Action", null).show();
              }
          });
      }
  
      private void loadAd(){
          if(!mAd.isLoaded()){
              mAd.loadAd("ca-app-pub-3940256099942544/5224354917", new AdRequest.Builder().build());
          }
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  
      @Override
      public void onRewardedVideoAdLoaded() {
          mWatchButton.setEnabled(true);
          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();
          mWatchButton.setEnabled(false);
          loadAd();
      }
  
      @Override
      public void onRewarded(RewardItem rewardItem) {
          Toast.makeText(this, "onRewarded", Toast.LENGTH_SHORT).show();
          mRewardLabel.setText(String.format(Locale.getDefault(), "You got %d %s!", rewardItem.getAmount(), rewardItem.getType()));
      }
  
      @Override
      public void onRewardedVideoAdLeftApplication() {
          Toast.makeText(this, "onRewardedVideoAdLeftApplication", Toast.LENGTH_SHORT).show();
      }
  
      @Override
      public void onRewardedVideoAdFailedToLoad(int i) {
          Toast.makeText(this, "onRewardedVideoAdFailedToLoad", Toast.LENGTH_SHORT).show();
      }
  
  
      @Override
      public void onPause() {
          super.onPause();
          mAd.pause(this);
      }
  
      @Override
      public void onResume() {
          super.onResume();
          mAd.resume(this);
      }
  
      @Override
      public void onDestroy() {
          super.onDestroy();
          mAd.destroy(this);
      }
  
  
  }
  </code></pre>
  
  <p>Here is the code from my layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      app:layout_behavior="@string/appbar_scrolling_view_behavior"
      tools:context="com.xxxxxx.MainActivity"
      tools:showIn="@layout/activity_main"&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Hello World!"
          android:id="@+id/textView" /&gt;
  
      &lt;Button
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Ver o anúncio"
          android:id="@+id/btn_watch"
          android:layout_below="@+id/textView"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginTop="58dp"/&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I receive no warning or error messages in logcat in Android Studio.</p>
  
  <p>I am using:</p>
  
  <pre><code>classpath 'com.google.gms:google-services:3.0.0'
  </code></pre>
  
  <p>and</p>
  
  <pre><code>    dependencies {
          compile fileTree(dir: 'libs', include: ['*.jar'])
          testCompile 'junit:junit:4.12'
          compile 'com.android.support:appcompat-v7:23.4.0'
          compile 'com.android.support:design:23.4.0'
          compile 'com.google.firebase:firebase-ads:9.4.0'
      }
  
  apply plugin: 'com.google.gms.google-services'
  </code></pre>