NativeAd
이 클래스의 최신 버전을 사용할 수 있습니다. 확인해보세요 최신 버전.

NativeAd provides ad creative for apps to rendered in custom layout.

To use NativeAd, do the following:

NativeAd nativeAd = new NativeAd(context, PLACEMENT_ID); nativeAd.setAdListener(new AdListener() { public void onAdLoaded(Ad ad) { if (ad == nativeAd) { // Renders the ad using creative properties String adTitle = getAdTitle(); } } // rest of AdListener implementation omitted }); nativeAd.loadAd();

Before displaying the ad, call NativeAd.registerViewForInteraction(View viewContainer) to handle logging of ad impressions and clicks.

확장:Object
구현:Ad
패키지:ads
생성자
NativeAd(Context, String)

Constructs an NativeAd using the given context and placement id.

public NativeAd(Context context, String placementId)
매개변수설명
contextAndroid context
placementIdId of ad placement
클래스 메서드
downloadAndDisplayImage(Image, ImageView)

Downloads the given Image and displays it in the given ImageView.

This method always returns immediately. Image is downloaded asynchronously.

public static void downloadAndDisplayImage(Image image, ImageView imageView)
매개변수설명
imageImage to be downloaded
imageViewView to show the downloaded image
인스턴스 메서드
setAdListener(AdListener)

Sets an AdListener to be notified on events happened in control lifecycle.

public void setAdListener(AdListener adListener)
매개변수설명
adListenerThe listener
setImpressionListener(ImpressionListener)

Sets an ImpressionListener to be notified of impression events in ad control lifecycle.

public void setImpressionListener(ImpressionListener impListener)
매개변수설명
impListenerThe listener
loadAd()

Loads an ad.

This method always returns immediately. The ad is loaded asynchronously. The control's ad listener will be called when loading finishes or fails.

public void loadAd()
loadAd()
public void loadAd()
destroy()

Destroys the ad control.

This method should be called when the hosting activity of the ad control is destroyed.

public void destroy()
destroy()
public void destroy()
isAdLoaded()

Gets whether an ad is loaded and ready to show.

public boolean isAdLoaded()
Returns
Whether an ad is loaded
getAdIcon()

Gets the icon creative.

public Image getAdIcon()
Returns
The ad icon
getAdCoverImage()

Gets the cover image creative.

public Image getAdCoverImage()
Returns
The ad cover image
getAdTitle()

Gets the title.

public String getAdTitle()
Returns
The ad title
getAdBody()

Gets the body, usually a longer description of the ad.

public String getAdBody()
Returns
The ad body
getAdCallToAction()

Gets the call to action phrase.

public String getAdCallToAction()
Returns
The call to action phrase
getAdSocialContext()

Gets the social context.

public String getAdSocialContext()
Returns
The social content sentence
getAdStarRating()

Gets the star rating.

public Rating getAdStarRating()
Returns
The star rating
getId()
public String getId()
registerViewForInteraction(View)

Registers the given view as the container for this NativeAd to handle impressions and clicks. Applies a click handler to the entire unit.

public void registerViewForInteraction(View view)
매개변수설명
viewThe View containing this NativeAd for display
registerViewForInteraction(View, List)

Registers the given view as the container for this NativeAd to handle impressions and clicks. Applies a click handler all views provided in clickableViews.

public void registerViewForInteraction(View view, List clickableViews)
매개변수설명
viewThe View containing this NativeAd for display
clickableViewsA list of all view elements that should handle taps on this unit
unregisterView()
public void unregisterView()