loadADWithPlacementID: method of ATAdManager to load the ad.Regarding the passthrough parameters for Auto Load Rewarded Video ads, you need to pay attention to the following callback method:
- (void)rewardedVideoDidStartPlayingForPlacementID:(NSString *)placementID extra:(NSDictionary *)extra {
NSLog(@"ATRewardedVideoViewController::rewardedVideoDidStartPlayingForPlacementID:%@ extra:%@", placementID, extra);
/* Set extra, custom parameters, which will be returned in the delegate's Extra and can be used for custom rule matching for this placement.
When the server-side Rewarded Video callback is enabled, set this value and it will be returned to the developer when the reward is granted.
Special note: If using a third-party Rewarded Video server-side callback service, due to the SDK's internal ad caching functionality, the passed extension parameters may not be able to achieve real-time updates. Therefore, if you have such requirements, please use the Rewarded Video server-side callback service we provide and set the corresponding extension parameters in the display API (requires using the regular Rewarded Video loading method).
*/
[[ATRewardedVideoAutoAdManager sharedInstance] setLocalExtra:
@{kATAdLoadingExtraUserIDKey:@"test_user_id"} placementID:@"your rv placementID"];
}
// Import header file
#import
/// Set up Auto Load Rewarded Video ad
/// - Parameter placementID: Placement ID
- (void)loadRewardedVideoADWithPlacementID:(NSString *)placementID {
[ATRewardedVideoAutoAdManager sharedInstance].delegate = self;
// Set extra, custom parameters, which will be returned in the delegate's Extra and can be used for custom rule matching for this placement.
// When the server-side Rewarded Video callback is enabled, set this value and it will be returned to the developer when the reward is granted.
[[ATRewardedVideoAutoAdManager sharedInstance] setLocalExtra:
@{kATAdLoadingExtraUserIDKey:@"test_user_id"} placementID:placementID];
[[ATRewardedVideoAutoAdManager sharedInstance] addAutoLoadAdPlacementIDArray:@[placementID]];
}
- Please avoid displaying ads in the (didFinishLoadingADWithPlacementID:) callback, as this will cause a load-display loop.
- Before displaying, you need to first check that the current app is in the foreground.
/// Display ad
/// - Parameters:
/// - placementID: Placement ID
- (void)showRewardedVideoADWithPlacementID:(NSString *)placementID {
// Check if the ad is ready before displaying
BOOL isReady = [[ATRewardedVideoAutoAdManager sharedInstance] autoLoadRewardedVideoReadyForPlacementID:placementID];
if (isReady) {
[[ATRewardedVideoAutoAdManager sharedInstance] showAutoLoadRewardedVideoWithPlacementID:placementID inViewController:self delegate:self];
}
}
| Class Name / File Name | Introduction |
|---|---|
| ATAdManager | The base operation class for ads, including features such as ad loading, filtering ads, and scenario statistics. |
| ATRewardedVideoAutoAdManager | The management class for Auto Load Rewarded Video ads, providing features such as enabling Auto Load, removing Auto Load, setting local parameters, checking ready status, displaying ads, and scenario statistics. |
| ATAdLoadingDelegate | The base delegate callback declaration for ads, including placement-level and ad source-level load success or failure callbacks, as well as bidding completion and bidding failure callbacks for bidding ad sources. |
| ATRewardedVideoDelegate | Delegate callbacks specific to the Rewarded Video ad type, including display, click, dismiss, etc. |
| ATSDKGlobalSetting | A general settings class, providing features such as clearing ad memory caches, custom traffic group settings, test mode, setting third-party ad SDK related information, etc. It also declares some general properties. |