public class NativeBannerAd extends NativeAdBase
To use NativeBannerAd, do the following:
NativeBannerAd nativeBannerAd = new NativeBannerAd(context, PLACEMENT_ID);
nativeBannerAd.setAdListener(new AbstractAdListener() {
public void onAdLoaded(Ad ad) {
if (ad == nativeBannerAd) {
// Render the ad using the different properties. Eg.:
String adTitle = getAdTitle();
}
}
});
nativeBannerAd.loadAd();
Before displaying the ad, call com.facebook.ads.NativeBannerAd#registerViewForInteraction( android.view.View viewContainer,
MediaView iconView) to handle logging of ad impressions and clicks.
NativeAdBase.Image, NativeAdBase.MediaCacheFlag, NativeAdBase.NativeAdLoadConfigBuilder, NativeAdBase.NativeComponentTag, NativeAdBase.NativeLoadAdConfig, NativeAdBase.RatingAd.LoadAdConfig, Ad.LoadConfigBuilder| Constructor and Description |
|---|
NativeBannerAd(Context context,
com.facebook.ads.internal.api.NativeAdBaseApi nativeAdBaseApi) |
NativeBannerAd(Context context,
java.lang.String placementId) |
| Modifier and Type | Method and Description |
|---|---|
void |
registerViewForInteraction(View view,
ImageView iconView)
Registers the given view as the container and the required ImageView as the Icon display for
this NativeBannerAd to handle impressions and clicks.
|
void |
registerViewForInteraction(View view,
ImageView iconView,
java.util.List<View> clickableViews)
Registers the given view as the container and the required ImageView as the Icon display for
this NativeBannerAd to handle impressions and clicks.
|
void |
registerViewForInteraction(View view,
MediaView iconView)
Registers the given view as the container and the required MediaView as the Icon display for
this NativeBannerAd to handle impressions and clicks.
|
void |
registerViewForInteraction(View view,
MediaView iconView,
java.util.List<View> clickableViews)
Registers the given view as the container and the required MediaView as the Icon display for
this NativeBannerAd to handle impressions and clicks.
|
buildLoadAdConfig, destroy, downloadMedia, fromBidPayload, getAdBodyText, getAdCallToAction, getAdChoicesIcon, getAdChoicesImageUrl, getAdChoicesLinkUrl, getAdChoicesText, getAdCoverImage, getAdHeadline, getAdIcon, getAdLinkDescription, getAdSocialContext, getAdStarRating, getAdTranslation, getAdUntrimmedBodyText, getAdvertiserName, getAdViewAttributes, getAspectRatio, getId, getInternalNativeAd, getPlacementId, getPreloadedIconViewDrawable, getPromotedTranslation, getSponsoredTranslation, hasCallToAction, isAdInvalidated, isAdLoaded, isNativeConfigEnabled, loadAd, loadAd, onCtaBroadcast, setExtraHints, setOnTouchListener, unregisterViewpublic NativeBannerAd(Context context,
java.lang.String placementId)
context - placementId - public NativeBannerAd(Context context,
com.facebook.ads.internal.api.NativeAdBaseApi nativeAdBaseApi)
public void registerViewForInteraction(View view,
MediaView iconView)
view - the View containing this NativeBannerAd for displayiconView - IconView to display Icon for this NativeBannerAdpublic void registerViewForInteraction(View view,
MediaView iconView,
java.util.List<View> clickableViews)
view - the View containing this NativeBannerAd for displayiconView - IconView to display Icon for this NativeBannerAdclickableViews - a list of all view elements that should handle taps on this unitpublic void registerViewForInteraction(View view,
ImageView iconView)
view - the View containing this NativeBannerAd for displayiconView - ImageView to display Icon for this NativeBannerAdpublic void registerViewForInteraction(View view,
ImageView iconView,
java.util.List<View> clickableViews)
view - the View containing this NativeBannerAd for displayiconView - ImageView to display Icon for this NativeBannerAdclickableViews - a list of all view elements that should handle taps on this unit