Currently supported native advertising access methods are: Self-rendering information flow advertising , Template information flow advertisement, Draw information flow advertisement
Note: The above native ad styles use the same set of APIs for access, and developers can mix different native styles in the same waterfall flow
Access method | Description |
---|---|
Self-rendering information flow advertisement | Developers can obtain all advertising materials through the API and customize their own UI layout for access. The access method can be viewed: Information flow self-rendering ads |
Template information flow ads | Developers can obtain a fully rendered ad View through the API, and directly add it to the designated location for display. Enter the method to view: Information flow template advertisement |
Draw information flow advertisement | Mainly suitable for scene access of full-screen page-turning video information flow, access method Can be viewed: Draw information flow advertising access |
API | Parameter | Description |
---|---|---|
ATNative | Context context, String nativeTakuPlacementID, ATNativeNetworkListener listener | Native advertising initialization method, in which nativeTakuPlacementID is created through the Taku background Native advertising slotObtained |
Method | Parameters | |
---|---|---|
onNativeAdLoaded | - | Ad loaded successfully |
onNativeAdLoadFail | (AdError error) | Ad loading failed, all error information can be obtained through AdError.getFullErrorInfo(), please refer to AdError Note: It is forbidden to execute advertisements in this callback Loading method to retry, otherwise it will cause a lot of useless requests and may cause the application to freeze |
NativeAd: Obtained through getNativeAd Ad object
API | Parameters | Description |
---|---|---|
setLocalExtra | Map | Set local parameters |
makeAdRequest | - | Initiate a Native ad request |
getNativeAd | - | Get loaded ads(recommendation After obtaining, a non-null judgment must be made, because null may appear in some cases, and it will be null when there is no ad cache) Note: After calling this method, the SDK will remove the ad cache once. If the NativeAd obtained through this method is not null, the developer must reference it by themselves for subsequent ad display, otherwise the next time this method is called, null may be returned due to no ad cache |
(Deprecated since v6.3.10) Get the loaded ad(It is recommended to make a non-null judgment after obtaining it, because null may appear in some cases), and set advertising scenes for subsequent ads. Please refer to Advertising scene Note: Same as above | ||
getNativeAd | (ATShowConfig showConfig) | (v6.3.10+) Get the loaded ad(It is recommended to make a non-null judgment after obtaining it, because null may appear in some cases) showConfig: You can pass in additional parameters during display, as follows 1.ATShowConfig#showCustomExt(String showCustomExt): You can pass in custom parameters during display, and the parameters passed in will be returned through ATAdInfo#getShowCustomExt() 2.ATShowConfig#scenarioId(String scenarioId): Advertising scenarios can be passed in, the same as getNativeAd(String scenario) |
(static) entryAdScenario | (String placementId, String scenarioId) | Enter the current business scenario Ad space cache status statistics. The scenario refers to the advertising display scene (not required, null can be passed directly). Scene parameters can be |
checkValidAdCaches | Query the ATAdInfo object of all cached information of the current ad slot ATAdInfo: the information object of the advertisement, which can be distinguished Advertising platform, mainly includes the id information of the third-party aggregation platform See ATAdInfo information description |
Method th> | Parameters | Description |
---|---|---|
isNativeExpress | - | Whether it is a template rendering type of advertisement |
renderAdContainer | (ATNativeAdView view, View selfRenderView) | is used for ad rendering, where the view must use the ATNativeAdView we provide Note: When calling isNativeExpress() to return false (i.e. self-rendering), selfRenderView must pass in the developer's customized View. When returning true (template rendering), null can be passed |
(ATNativeAdView view, ATNativePrepareInfo nativePrepareInfo) | is used to configure ad click events, bind the close button during self-rendering, control the placement and size of the ad logo, etc., and is called after the renderAdContainer method (By default, all views are clickable, and those with advertising logos will have default placement and size) |
API | Parameter | Description |
---|---|---|
getAdInfo | - | Get the current ad cache information ATAdInfo object, which mainly includes the id information of the third-party aggregation platform. See ATAdInfo information description |
clear | (ATNativeAdView view) | Remove the binding of the ad to the view |
onResume | - | Called during Activity's onResume (mainly for video ads on some advertising platforms) |
onPause | - | Called during Activity's onPause ( Mainly for video ads on some advertising platforms) |
destory | - | Destroy the current ad object (the ad can no longer be displayed after execution) |
method | Parameters | Description |
---|---|---|
setNativeEventListener | (ATNativeEventListener listener) | Set advertising event listening, where ATNativeEventListener is the interface class of advertising events |
setDislikeCallbackListener | (ATNativeDislikeListener listener) | Set ad closing event callback(Currently only pangolin (Pangle), Guangdiantong and Kuaishou template ads are valid) |
Method | Parameters | Description |
---|---|---|
onAdCloseButtonClick | (ATNativeAdView view, ATAdInfo atAdInfo) | This method is called when the close button is clicked. If you want to remove the advertisement, the developer needs to manually call the code in this callback to remove the Native View. ATAdInfo is the information object of the advertisement, which mainly contains the id information of the third-party aggregation platformSee ATAdInfo information description |
method | Parameters | Description |
---|---|---|
onAdImpressed | (ATNativeAdView view, ATAdInfo atAdInfo) | |
onAdClicked | (ATNativeAdView view, ATAdInfo atAdInfo) | Advertising Click callback The meaning of parameters is the same as above |
onAdVideoStart | (ATNativeAdView view) | Ad video playback starts (only exists on some advertising platforms) |
onAdVideoEnd | ( ATNativeAdView view) | Advertising video playback ends (only exists on some advertising platforms) |
onAdVideoProgress | (ATNativeAdView view, int progress) |