Skip to content

Instantly share code, notes, and snippets.

@ayltai
Created February 12, 2017 09:36
Show Gist options
  • Save ayltai/e4c75c672cee7371f44b61f91dd94499 to your computer and use it in GitHub Desktop.
Save ayltai/e4c75c672cee7371f44b61f91dd94499 to your computer and use it in GitHub Desktop.
Extending CustomNativeEvent class
@Override
public void loadNativeAd(@NonNull final Context context,
@NonNull final CustomEventNative.CustomEventNativeListener customEventNativeListener,
@NonNull final Map<String, Object> localExtras,
@NonNull final Map<String, String> serverExtras) {
final String adUnitId = serverExtras.get(KEY_AD_UNIT_ID);
if (this.validateAdUnitId(adUnitId)) {
final FacebookNativeAd nativeAd = this.createNativeAd(context, customEventNativeListener, null, adUnitId);
this.onLoadNativeAd(nativeAd);
nativeAd.fetchAd();
} else {
customEventNativeListener.onNativeAdFailed(NativeErrorCode.NATIVE_ADAPTER_CONFIGURATION_ERROR);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment