Android SDK Version
  • java.lang.Object
    • com.facebook.ads.NativeAdsManager

public class NativeAdsManager
extends java.lang.Object
The NativeAdsManager provides a mechanism to fetch a set of NativeAds and then use them within your application. The recommended usage is to call nextNativeAd() at the moment when you are about to render an ad. The NativeAdsManager can hold at most 10 unique ads at once but supports giving out as many ads as needed by cloning over the set of NativeAds it got back from the server which can be useful for feed scenarios.
When calling loadAds() an optional NativeAd.MediaCacheFlag can be passed to indicate whether to pre-cache the ad images (image, icon, all, or none). If not set, no images will be pre-cached before onAdsLoaded() is called.
Since:
4.6
Nested Class Summary
Modifier and TypeClass and Description
static interface NativeAdsManager.Listener 
Constructor Summary
Constructor and Description
NativeAdsManager(Context context, java.lang.String placementId, int numAdsRequested) 
Method Summary
Modifier and TypeMethod and Description
voiddisableAutoRefresh() 
intgetUniqueNativeAdCount() 
booleanisLoaded() 
voidloadAds() 
voidloadAds(NativeAdBase.MediaCacheFlag mediaCacheFlag) 
NativeAdnextNativeAd() 
voidsetExtraHints(java.lang.String extraHints) 
voidsetListener(NativeAdsManager.Listener listener) 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail

NativeAdsManager

public NativeAdsManager(Context context,
                        java.lang.String placementId,
                        int numAdsRequested)
Parameters:
context -
placementId -
numAdsRequested -
Since:
4.6
Method Detail

setListener

public void setListener(NativeAdsManager.Listener listener)
Parameters:
listener -
Since:
4.6

setExtraHints

public void setExtraHints(java.lang.String extraHints)

loadAds

public void loadAds()
Since:
4.6

loadAds

public void loadAds(NativeAdBase.MediaCacheFlag mediaCacheFlag)
Parameters:
mediaCacheFlag -
Since:
4.6

getUniqueNativeAdCount

public int getUniqueNativeAdCount()
Returns:
Since:
4.6

nextNativeAd

public NativeAd nextNativeAd()
Returns:
Since:
4.6

isLoaded

public boolean isLoaded()
Returns:
Since:
4.6

disableAutoRefresh

public void disableAutoRefresh()
Since:
4.6