Package com.my.target.nativeads
Class NativeAdLoader
- java.lang.Object
-
- com.my.target.common.BaseAd
-
- com.my.target.nativeads.NativeAdLoader
-
public final class NativeAdLoader extends BaseAd
Allows you to load from 1 to 20 banners per one request. You can configure all the same settings that are available for customization inNativeAd(for example, user's gender and age, autoloading images and videos). There is no guarantee that the number of banners specified in the COUNT parameter will be loaded - this parameter indicates the maximum number of banners that you want to receive.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceNativeAdLoader.OnLoad
-
Field Summary
-
Fields inherited from class com.my.target.common.BaseAd
adConfig, metricFactory
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCachePolicy()Retrieve current cachePolicyNativeAdLoaderload()Method responsible for loading data.static NativeAdLoadernewLoader(int slotId, int bannersCount, android.content.Context context)The static constructor of the object.static NativeAdLoadernewLoader(int slotId, int bannersCount, android.content.Context context, MenuFactory menuFactory)The static constructor of the object.voidsetCachePolicy(int cachePolicy)By default, images and videos are preloaded.NativeAdLoadersetOnLoad(NativeAdLoader.OnLoad onLoad)Set listener for loading event-
Methods inherited from class com.my.target.common.BaseAd
getCustomParams, isLoadCalled, setAdNetworkConfig
-
-
-
-
Method Detail
-
newLoader
@NonNull public static NativeAdLoader newLoader(int slotId, int bannersCount, @NonNull android.content.Context context)
The static constructor of the object.- Parameters:
slotId- slot numberbannersCount- maximum number of banners that you want to receive.context- application context- Returns:
- NativeAdLoader object
-
newLoader
@NonNull public static NativeAdLoader newLoader(int slotId, int bannersCount, @NonNull android.content.Context context, @NonNull MenuFactory menuFactory)
The static constructor of the object.- Parameters:
slotId- slot numberbannersCount- maximum number of banners that you want to receive.context- application contextmenuFactory- menuFactory- Returns:
- NativeAdLoader object
-
setOnLoad
@UiThread @NonNull public NativeAdLoader setOnLoad(@Nullable NativeAdLoader.OnLoad onLoad)
Set listener for loading event- Parameters:
onLoad- listener instance, can be null- Returns:
- NativeAdLoader object
-
getCachePolicy
public int getCachePolicy()
Retrieve current cachePolicy- Returns:
- current cachePolicy
- See Also:
CachePolicy
-
setCachePolicy
public void setCachePolicy(int cachePolicy)
By default, images and videos are preloaded. You can turn off the automatic loading of images and videos, but keep in mind that downloading them will take extra time, which will create an additional delay in displaying ads in your application.- Parameters:
cachePolicy- cache policy needed- See Also:
CachePolicy
-
load
@UiThread @NonNull public NativeAdLoader load()
Method responsible for loading data. In case of successful loading, the onLoad method will be called on the object passed as a listener>- See Also:
NativeBannerAdLoader.OnLoad
-
-