/** Destroys all queued ads and removes them from memory */ void destroyAds() { mFetchFailCount = 0; mIsCurrentlyFetching = false; if (mCurrentFlurryAdNative != null) { mCurrentFlurryAdNative.destroy(); } for (FlurryAdNative adNative : AD_QUEUE) { adNative.destroy(); } AD_QUEUE.clear(); RETRY_FETCH_HANDLER.removeMessages(0); }
@Override public void onFetched(FlurryAdNative flurryAdNative) { if (isAdUsable(flurryAdNative)) { AD_QUEUE.addLast(flurryAdNative); mFetchFailCount = 0; mFetchSucceedCount += 1; /* Inform the fetch listener that an ad has been fetched so it can get the ad from FlurryNativeAdFetcher#popLoadedAd() whenever it wants. */ if (mFetchListener != null) { mFetchListener.onAdFetched(); } for (FlurryAdNativeListener listener : mExternalListeners) { listener.onFetched(flurryAdNative); } } else { flurryAdNative.destroy(); } // Replenish immediately replenishAdQueue(); }
private void a(FlurryAdNative paramFlurryAdNative, boolean paramBoolean) { if (paramBoolean) { paramFlurryAdNative.removeTrackingView(); paramFlurryAdNative.destroy(); } if (e.contains(paramFlurryAdNative)) { e.remove(paramFlurryAdNative); } if (f.contains(paramFlurryAdNative)) { f.remove(paramFlurryAdNative); } }
@Override public void onError( FlurryAdNative flurryAdNative, FlurryAdErrorType flurryAdErrorType, int errorCode) { if (flurryAdErrorType == FlurryAdErrorType.FETCH) { mFetchFailCount++; flurryAdNative.destroy(); } // Retry after some delay RETRY_FETCH_HANDLER.postDelayed(RETRY_FETCH_RUNNABLE, RETRY_TIME_MILLI); for (FlurryAdNativeListener listener : mExternalListeners) { listener.onError(flurryAdNative, flurryAdErrorType, errorCode); } Log.w(TAG, "onError. Error code: " + errorCode); }