Пример #1
0
  /*
   * Tears down the ad view: no ads will be shown once this method executes. The parent
   * Activity's onDestroy implementation must include a call to this method.
   */
  public void destroy() {
    unregisterScreenStateBroadcastReceiver();

    if (mAdView != null) {
      mAdView.cleanup();
      mAdView = null;
    }

    if (mAdapter != null) {
      mAdapter.invalidate();
      mAdapter = null;
    }
  }
Пример #2
0
  protected void loadNativeSDK(HashMap<String, String> paramsHash) {
    if (mAdapter != null) mAdapter.invalidate();

    String type = paramsHash.get("X-Adtype");
    mAdapter = BaseAdapter.getAdapterForType(type);

    if (mAdapter != null) {
      Log.i("MoPub", "Loading native adapter for type: " + type);
      String jsonParams = paramsHash.get("X-Nativeparams");
      mAdapter.init(this, jsonParams);
      mAdapter.loadAd();
    } else {
      Log.i("MoPub", "Couldn't load native adapter. Trying next ad...");
      loadFailUrl();
    }
  }