Prerequisites:
- GDT SDK version >= 4.15.70
- Taku SDK version >= v6.5.34
- AnyThinkMediationGDTAdapter version > 4.15.70.0
ATNativeAdOffer instance when retrieving an ATNativeAdOffer object to display an ad......other native ad integration code
ATNativeAdOffer *offer = [[ATAdManager sharedManager] getNativeAdOfferWithPlacementID:xxx showConfig:showConfig];
//#import <GDTMobSDK/GDTMobSDK.h>
// Identify the ad platform by networkFirmID. For details, see: https://help.takuad.com/docs/2KR6QU
if (offer.networkFirmID == 8) {
id<ATNativeMaterialProtocol> nativeAd = offer.nativeAd;
if (nativeAd && [nativeAd isKindOfClass:[ATCustomNetworkNativeAd class]]) {
ATCustomNetworkNativeAd *customAd = (ATCustomNetworkNativeAd *)nativeAd;
NSDictionary *mediaExt = nil;
if ([customAd respondsToSelector:@selector(mediaExt)]) {
mediaExt = customAd.mediaExt;
}
GDTUnifiedNativeAdDataObject *obj = nil;
if ([customAd respondsToSelector:NSSelectorFromString(@"dataObj")]) {
obj = [customAd valueForKey:@"dataObj"];
}
if (mediaExt != nil && obj != nil) {
// After obtaining the mediaExt and GDTUnifiedNativeAdDataObject
// returned by the ad platform, complete the integration according
// to the GDT documentation.
}
}
}
......other native ad integration code
Notes:
- Behavior-incentive parameters must be added to
extrabefore callingloadAD.- Set
rewardDelegateonly for Pangle native ads.
Before calling loadAD, use extra to set the reward coin amount and required viewing duration:
/// Parameters passed through for Pangle native-ad incentives on the store page:
/// provide the reward coin amount and required viewing duration.
NSMutableDictionary *extra = [NSMutableDictionary dictionary];
[extra setValue:@(999) forKey:kATTTNativeECRewardGoldKey];//Param type: Integer
[extra setValue:@(5) forKey:kATTTNativeECRewardDurationKey];//Param type: Integer
[[ATAdManager sharedManager] loadADWithPlacementID:self.currentPlacementIDInfoModel.placementIDString extra:extra delegate:self];
ATNativeAdOffer object for displayUse networkFirmID to determine whether the ad platform is Pangle. When nativeAd is an ATTTNativeObject, set rewardDelegate:
......other native ad integration code
ATNativeAdOffer *offer = [[ATAdManager sharedManager] getNativeAdOfferWithPlacementID:xxx showConfig:showConfig];
// Set the reward callback delegate only for Pangle native ads.
if (offer.networkFirmID == ATNetworkFirmIDTypeCSJ) {
if ([offer.nativeAd isKindOfClass:[ATTTNativeObject class]]) {
ATTTNativeObject *object = (ATTTNativeObject *)offer.nativeAd;
object.rewardDelegate = self;
}
}
......other native ad integration code
Have the view controller conform to ATTTNativeRewardDelegate and implement the following method to receive behavior-incentive events:
#pragma mark - ATTTNativeRewardDelegate
- (void)onEventCode:(BUNativeAdEventCode)code info:(NSDictionary *)info {
ATDemoLog(@"ATNativeViewController:: onEventCode:%ld info:%@", (long)code, info);
}
Handle reward delivery, logging, or UI notifications according to your business requirements based on the callback's code and info.