Example #1
0
  @Override
  protected void onWindowVisibilityChanged(int visibility) {
    if (mAdView == null) return;

    if (visibility == VISIBLE) {
      Log.d("MoPub", "Ad Unit (" + mAdView.getAdUnitId() + ") going visible: enabling refresh");
      mIsInForeground = true;
      mAdView.setAutorefreshEnabled(true);
    } else {
      Log.d("MoPub", "Ad Unit (" + mAdView.getAdUnitId() + ") going invisible: disabling refresh");
      mIsInForeground = false;
      mAdView.setAutorefreshEnabled(false);
    }
  }
Example #2
0
 /*
  * Stops refreshing ads.
  */
 protected void cleanup() {
   setAutorefreshEnabled(false);
 }
Example #3
0
 public void setAutorefreshEnabled(boolean enabled) {
   if (mAdView != null) mAdView.setAutorefreshEnabled(enabled);
 }