Skip to content

Android

Hive Adkit for ADOP: Android

Installation

  1. Download the latest version of Hive Adkit and extract it.
  2. Copy the Adkit.gradle file to the path of your project app.
  3. Add the following content to the build.gradle file of your project app.
apply from: '(path to adkit.gradle file)/adkit.gradle'

dependencies {
    // ...(skip)

            // add the AdKit library
    implementation "com.com2us.android:hive-adkit-adop:1.5.1"
}

Settings

Add the AdMobId value in the format ca-app-pub-XXXXX~YYYYY and the ADOP APP_DOMAIN to the AndroidManifest.xml file created in the Android project.

Warning

Starting from AdKit version 1.5.1, the previously used APP_KEY has been changed to APP_DOMAIN. APP_DOMAIN is not compatible with the existing APP_KEY, so you must obtain a new APP_DOMAIN for Hive AdKit initialization. For information regarding APP_DOMAIN, please contact the Tech Labs Platform Business Division Operations Team.

<application>
        <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-XXXXX~YYYYY"/>
    <meta-data
        android:name="com.google.android.gms.ads.AD_MANAGER_APP"
        android:value="true"/>
    <meta-data
        android:name="com.adop.sdk.APP_DOMAIN"
        android:value="INSERT_YOUR_APP_DOMAIN"/>
    </application>

Applying

ADOP Proguard Configuration

If you are using Proguard, you need to add the following ADOP Proguard settings.

-keep class com.adop.sdk.** { *; }
-keep class ad.helper.openbidding.** { *; }
-keep class com.adop.sdk.adapter.**{ *; }
-keepnames class * implements java.io.Serializable
-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    !static !transient <fields>;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}
-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}

# Pangle
-keep class com.bytedance.sdk.** { *; }
-keep class com.bykv.vk.openvk.component.video.api.** { *; }

# Tapjoy
-keep class com.tapjoy.** { *; }
-keep class com.moat.** { *; }
-keepattributes JavascriptInterface
-keepattributes *Annotation*
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
-keep class com.google.android.gms.ads.identifier.** { *; }
-dontwarn com.tapjoy.**

ADOP Test Advertisement Key

You must use the ad key issued by ADOP instead of AdMob.

var bannerZoneId = "944fe870-fa3a-4d1b-9cc2-38e50b2aed43"
var interstitialZoneID = "e9acd7fc-a962-40e4-aaad-9feab1b4f821"
var rewardVideoZoneId = "7d9a2c9e-5755-4022-85f1-6d4fc79e4418"
var appOpenAdZoneId = "33906f96-dae8-4790-8ce4-d1f287ba00b2"

Hive AdKit initialization

When performing Hive AdKit initialization in Europe and the UK (EEA & UK), the GDPR consent popup will be automatically displayed. In other regions, the initialization will proceed immediately.

  • If the game targets Europe and the UK (EEA & UK), please ensure that the GDPR consent popup is set according to the GDPR message creation guide.

import com.com2us.hive.adkit.*

// Commercial
AdKit.InitializeWithShowGDPRConsent(this.activity, false, null) {
    /* 
    동의 = 1, 비동의 = 0, 알수없음 = -1, 필요없음 = -2
    초기화 완료 콜백으로 GDPR 동의 상태 결과 값 consentState가 전달됩니다. 결과값에 따른 별도 처리가 필요하지 않습니다. 
    */
    Log.d("HIVEAdKit", "InitializeWithShowGDPRConsent onComplete consentState : $it")
}

// GDPR EEA 테스트모드
AdKit.InitializeWithShowGDPRConsent(this.activity, true, gdprTestDeviceId) {
    /* 
    동의 = 1, 비동의 = 0, 알수없음 = -1, 필요없음 = -2
    초기화 완료 콜백으로 GDPR 동의 상태 결과 값 consentState가 전달됩니다. 결과값에 따른 별도 처리가 필요하지 않습니다. 
    */
    Log.d("HIVEAdKit", "InitializeWithShowGDPRConsent onComplete consentState : $it")
}

You can include additional user information at the time of log generation in analytics. It transmits data of JSONObject type.

>val data = JSONObject()
data.put("level", 1)
data.put("gold",100)
AdKit.SetAdditionalInfo(data)

RewardVideo type advertisement

This is a reward-based advertisement that provides rewards for watching for a certain amount of time. Only one ad can be loaded at a time.

// RewardVideo Instance Create
var rewardVideo:RewardVideo? = null
rewardVideo = RewardVideo.Initialize(this.activity, rewardVideoZoneId, object : EventHandlers() {
    override fun onAdLoaded() {}
    override fun onAdOpening() {}
    override fun onAdClosed() {}
    override fun onAdFailed() {}
    override fun onAdClick() {}
    override fun onAdReward() {}
})

// RewardVideo Load
rewardVideo?.LoadAd("NativeRewardVideo-Load")

// RewardVideo Show
rewardVideo?.Show("NativeRewardVideo-Show")

You can deliver including ad placement data. It passes the string set at the time of Load success and the time it will be displayed through Show.

Interstitial type advertisement

This is a full-screen interstitial ad.

// Interstitial Instance Create
var interstitial:Interstitial? = null
interstitial = Interstitial.Initialize(this.activity, interstitialZoneId, object : EventHandlers() {
    override fun onAdLoaded() {}
    override fun onAdOpening() {}
    override fun onAdClosed() {}
    override fun onAdFailed() {}
    override fun onAdClick() {}
})

// Interstitial Load
interstitial?.LoadAd("NativeInterstitial-Load")

// Interstitial Show
interstitial?.Show("NativeInterstitial-Show")

You can deliver including ad location data. It passes the string set at the time of Load success and the time it will be exposed through Show.

Adaptive banner type advertisement

It is a rolling banner that occupies part of the screen. You can adjust the banner position by entering the BannerPosition value or a specific yPos value. When adjusting the banner position by entering the yPos value, the banner position moves up by the specified yPos value from the Bottom alignment state.

// Banner Instance Create
var adaptiveBanner: AdaptiveBanner? = null

// Create AdaptiveBanner Instance at Top of View
adaptiveBanner = AdaptiveBanner.Initialize(this.activity, bannerZoneId, AdaptiveBanner.BannerPosition.Top, object : EventHandlers() {
   override fun onAdLoaded() {}
   override fun onAdOpening() {}
   override fun onAdClosed() {}
   override fun onAdFailed() {}
   override fun onAdClick() {}
})

// Create AdaptiveBanner Instance at Bottom of View
adaptiveBanner = AdaptiveBanner.Initialize(this.activity, bannerZoneId, AdaptiveBanner.BannerPosition.Bottom, object : EventHandlers() {
   override fun onAdLoaded() {}
   override fun onAdOpening() {}
   override fun onAdClosed() {}
   override fun onAdFailed() {}
   override fun onAdClick() {}
})

// AdaptiveBanner Load & Automatic show
adaptiveBanner?.LoadAd("NativeAdaptiveBanner-Load")

// Destroy AdaptiveBanner
adaptiveBanner?.Destroy()

 

// Banner Instance Create
var adaptiveBanner: AdaptiveBanner? = null
adaptiveBanner = AdaptiveBanner.Initialize(this.activity, bannerZoneId, yPos, object : EventHandlers() {
   override fun onAdLoaded() {}
   override fun onAdOpening() {}
   override fun onAdClosed() {}
   override fun onAdFailed() {}
   override fun onAdClick() {}
})

// Banner Load
adaptiveBanner?.LoadAd("NativeAdaptiveBanner-Load")

// Banner Show
adaptiveBanner?.Show("NativeAdaptiveBanner-Show")

// Banner Hide
adaptiveBanner?.Hide()

// yPos 값에 따라 위치 변경
adaptiveBanner?.setPosition(yPos)

You can include advertising location data when delivering. It passes the string set at the time of Load success and the time it will be displayed through Show.

AppOpen type ads

This is an app open ad that displays ads when the app state changes from background to foreground.

// Create AppOpenAd Instance
var appOpenAd: AppOpenAd? = null    
appOpenAd = AppOpenAd.Initialize(this.activity, appOpenAdZoneId, object : EventHandlers() {
    override fun onAdLoaded() {}
    override fun onAdOpening() {}
    override fun onAdClosed() {}
    override fun onAdFailed() {}
})

// Automatically load & show AppOpenAd when the app comes to the foreground
appOpenAd?.LoadAd("NativeAppOpen-Load")

// Destroy AppOpenAd
appOpenAd?.Destroy()

Test ads

During development, it is important to set up test ads so that clicking on them does not incur costs for the advertiser. Excessive clicking on ads while not in test mode can lead to your account being flagged for invalid activity, which may result in a ban on receiving ads. You can find out how to use test ads on the Google Developers site.

Remove

Restores the files set during installation to their original state.