RewardVideo For iOS english - unigeniee/Geniee-iOS-SDK GitHub Wiki
Rewarded video ad is an advertisement format that displays video ads of approximate from 15 to 30 seconds and gives users items or points in the application.
For Geniee SDK, mediation adapter displays rewarded video advertisements of each 3rd ad network.
To prepare for implementation of native ads, please follow the guide below. You need to install Geniee SDK to your project. Start Guide
- SDK for each ad network, adapters The following settings are required for RewardVideo.
- Setting of SDK for each ad network
- Adapter setting is required.
Refer to the installation method from the link below.
Ad network | Version |
---|---|
maio | 1.4.0 |
AppLovin | 5.1.1 |
Unity Ads | 2.3.0 |
AdColony | 3.3.5 |
CAReward | 2.3.1 |
Tapjoy | 12.0.0 |
Vungle | 6.2.0 |
Nend | 5.0.2 |
AMoAd | playable1.0.0 |
Objective-C
https://github.com/geniee-ssp/Geniee-iOS-SDK/tree/master/sample/use_cocoapods/objectivec
Swift
https://github.com/geniee-ssp/Geniee-iOS-SDK/tree/master/sample/use_cocoapods/swift
The following classes are used for iOS rewarded video delivery. GNSRequest.h GNSRewardVideoAd.h GNSRewardVideoAdDelegate.h
Import header file and add Delegate
Example:ViewController.h
#import <GNAdSDK/GNSRewardVideoAd.h>
#import <GNAdSDK/GNSRequest.h>
#import <GNAdSDK/GNSAdReward.h>
#import <GNAdSDK/GNSRewardVideoAdDelegate.h>
@interface ViewController <GNSRewardVideoAdDelegate>
- This implementation is optional.
In the RewardVideo Ad SDK, set Delegate.
If you want to handle the following delgate, please implement delgate in ViewController which receives callback. If you describe it in viewDidLoad, viewDidLoad will not be executed after screen transition, delegate may not be set in some cases. The life cycle of iOS is involved.
Example:Viewcontroller.m (viewWillAppear recommended)
viewWillAppeare(){
[GNSRewardVideoAd sharedInstance].delegate = self;
}
To receive notification from the SDK, implement the method of GNSRewardVideoAdDelegate.
Example:Viewcontroller.m
/// Define the failure to reload video ads in delegates.
- (void)rewardVideoAd:(GNSRewardVideoAd *)rewardVideoAd
didFailToLoadWithError:(NSError *)error {
}
/// Define the load of Rewards video ad with delegate.
- (void)rewardVideoAdDidReceiveAd:(GNSRewardVideoAd *)rewardVideoAd {
}
/// Define the start of replay video ad playback in the delegate.
- (void)rewardVideoAdDidStartPlaying:(GNSRewardVideoAd *)rewardVideoAd {
}
/// Define that a delegate will close a Rewards video ad.
- (void)rewardVideoAdDidClose:(GNSRewardVideoAd *)rewardVideoAd {
}
/// Define rewards for users of reward video ads in delegates.
- (void)rewardVideoAd:(GNSRewardVideoAd *)rewardVideoAd
didRewardUserWithReward:(GNSAdReward *)reward {
}
Set load request to ZoneID (App ID) and request video ad load.
Note:
Load requests can take several seconds or more, so loadRequest video reward ads early in the application lifecycle.
If you want to display another video ad after a single video ad appears, you will need to run loadRequest again.
GNSRequest *request = [GNSRequest request];
[[GNSRewardVideoAd sharedInstance] loadRequest:request
withZoneID:@"YOUR_SSP_ZONE_ID"];
Make sure the video ad is ready and display the video ad.
if ([[GNSRewardVideoAd sharedInstance] canShow]) {
[[GNSRewardVideoAd sharedInstance] show:self];
}
To maximize revenue with video ads, it is important to remunerate video ad viewers. GNSAdReward includes the following items.
- reward.type:SSP currency type setting
- reward.amount:SSP currency amount setting
Use didRewardUserWithReward
callback method to reward users
- (void)rewardVideoAd:(GNSRewardVideoAd *)rewardVideoAd
didRewardUserWithReward:(GNSAdReward *)reward
{
NSLog(@"ViewController: Reward received type=%@, amount=%lf"
,reward.type
,[reward.amount doubleValue]);
}
Add the following to the Info.plist file of the Xcode project:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsLocalNetworking</key>
<true/>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>