Hive AdKit for ADOP: iOS
Setting
- Add the
GADApplicationIdentifier
key to the Xcode project’s Info.plist file, and add the AdMobId value (the format in ca–app–pub–XXXXX~YYYYY) as the value for the key. Also, enter ADOP APP_KEY as the value for theBidmadAppKey
key. ADOP APP_KEY can be found in Account Management > My Information > Details after logging in to ADOP Insight.
123456<key>GADApplicationIdentifier</key><string>ca-app-pub-XXXXX~YYYYY</string><key>BidmadAppKey</key><string>6b097551-7f78-11ed-a117-026864a21938</string> - On iOS 14 and higher, add SKAdNetwork list to the Info.plist file by referring to the Preparing for iOS 14 guide.
- Add the followings to the CocoaPods settings of your project app:
12345678910source 'https://github.com/CocoaPods/Specs.git'source 'https://github.com/Com2uSPlatformCorp/HiveAdKit-iOS.git'platform :ios, '12.0'use_frameworks!inhibit_all_warnings!target 'MyGame-mobile' dopod 'HiveAdKit_ADOP', '1.4.6'end - Run the following to apply CocoaPod settings.
1$pod install
How to Use
Test Ad Key in ADOP
Using a test ad key that ADOP issued, not AdMob, is required.
1 2 3 4 5 6 |
let rewardVideoUnitId: String = "29e1ef67-98d2-47b3-9fa2-9192327dd75d" let InterstitialAdUnitId: String = "228b95a9-6f42-46d8-a40d-60f17f751eb1" let AdaptiveBannerAdUnitId: String = "1c3e3085-333f-45af-8427-2810c26a72fc" let AppOpenAdUnitId: String = "0ddd6401-0f19-49ee-b1f9-63e910f92e77" |
Initialize Hive AdKit
Perform Hive AdKit initialization.
When performing a reset, if you are in the European and UK (EEA & UK) regions, a GDPR consent pop-up will be automatically displayed. In other regions, a reset is performed immediately.
- If your game targets the EEA & UK region, make sure your GDPR consent pop-up is set up according to the GDPR messaging guide.
1 2 3 4 5 6 7 8 9 10 |
import AdKit // Commercial AdKit.InitializeWithShowGDPRConsent(appKey: appKey, vc: self, bLog: false, gdprTestDeviceId: nil) // GDPR EEA test mode AdKit.InitializeWithShowGDPRConsent(appKey: appKey, vc: self, bLog: true, gdprTestDeviceId: gdprTestDeviceId) |
Delivering the user’s additional information can be included when a Hive Analytics log happens, and the data is passed in JSONObject type.
1 2 3 |
let dict = Dictionary<String, Any> (dictionaryLiteral: ("level",1),("gold",100)) AdKit.SetAdditionalInfo(additionalInfo: dict) |
RewardVideo type
Rewardedvideo type ads reward a user who watched a video for a period of time, and is able to load one ad at a time.
1 2 3 4 5 6 7 8 9 10 |
// RewardVideo Instance Create var rewardVideo:RewardVideo? = nil rewardVideo = RewardVideo.initialize(vc: self, adUnitId: rewardVideoUnitId, eventHandler: self) // RewardVideo Load rewardVideo?.LoadAd(adPlacementInfo: "Native-RewardVideo-Load") // RewardVideo Show rewardVideo?.Show(adPlacementInfo: "Native-RewardVideo-Show") |
Also, adPlacementInfo
can be passed as a string that is set at the time of successful Load
or exposing an ad through Show
.
Interstitial type
Interstitial type ads use full-screen that cover the interface of game.
1 2 3 4 5 6 7 8 9 10 |
// Interstitial Instance Create var interstitialAd:Interstitial? = nil interstitialAd = Interstitial.initialize(vc: self, adUnitId: InterstitialAdUnitId, eventHandler: self) // Interstitial Load interstitialAd?.LoadAd(adPlacementInfo: "Native-Interstitial-Load") // Interstitial Show interstitialAd?.Show(adPlacementInfo: "Native-Interstitial-Show") |
Also, adPlacementInfo
can be passed as a string that is set at the time of successful Load
or exposing an ad through Show
.
Adaptive Banner type
Adaptive Banner type ads are a type of rolling banner that occupies a spot on screen. You can adjust the banner position with the BannerPosition or an yPos value.
If you provide yPos to adjust the banner position, the banner will be aligned at the bottom of the screen and then will move up by the yPos value you specify.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
// Create AdaptiveBanner Instance var adaptiveBanner:AdaptiveBanner? = nil // Initialize AdaptiveBanner Instance at the Top of View adaptiveBanner = AdaptiveBanner.initialize(vc: self, adUnitId: AdaptiveBannerAdUnitId, bannerPosition: BannerPosition.Top, eventHandler: self) // Initialize AdaptiveBanner Instance at the Bottom of View adaptiveBanner = AdaptiveBanner.initialize(vc: self, adUnitId: AdaptiveBannerAdUnitId, bannerPosition: BannerPosition.Bottom, eventHandler: self) // Load AdaptiveBanner adaptiveBanner?.LoadAd(adPlacementInfo: "Native-AdaptiveBanner-Load") // Destroy AdaptiveBanner adaptiveBanner?.Destroy() |
1 2 3 4 5 6 7 8 9 10 11 12 |
// This example shows adjusting the banner position with specifiying the yPos value. // Banner Instance Create var adaptiveBanner: AdaptiveBanner? = null adaptiveBanner = AdaptiveBanner.initialize(vc: self, adUnitId: AdaptiveBannerAdUnitId, yPos: yPos, eventHandler: self) // Load AdaptiveBanner adaptiveBanner?.LoadAd(adPlacementInfo: "Native-AdaptiveBanner-Load") // The position is adjusted following the yPos value. adaptiveBanner?.setPosition(yPosition:yPos) |
Also, adPlacementInfo
can be passed as a string that is set at the time of successful Load
or exposing an ad through Show
.
AppOpen type ads
A type that exposes an ad when the app state changes from background to foreground.
1 2 3 4 5 6 7 8 9 10 11 |
// Create AppOpenAd Instance var appOpen: AppOpen? =nil appOpen = AppOpen.initialize(vc: self, adUnitId: AppOpenAdUnitId, eventHandler: self, adPlacementInfo: "Native-AppOpen-LoadInfo") // Automatically load & show AppOpenAd when the app comes to the foreground appOpen?.LoadAd(adPlacementInfo: "Native-AppOpen-LoadInfo") // Destroy AppOpenAd appOpen?.Destroy() |
Test Ads
It is important for advertiser not to be charged when test ad is clicked in development. If you click ads too much out of test mode, it is regarded as invalid action. Therefore, be aware not to be a target account to report. Refer to the Google Developers to use a test ad.