Hive Adiz Android

Hive Adiz Android is an advertising module for Android provided by Hive to make it easier to use the advertising exposure features offered by AdMob. The types of advertisements provided by Hive Adiz Android are as follows:

  • Interstitial ads
  • Banner ads
  • Native ads
  • Rewarded ads
  • Rewarded Interstitial ads
  • App Opening ads

To install and use Hive Adiz Android, please refer to the guide below in order.

Installation

Add the Hive Adiz library item to the app-level Gradle file (app/build.gradle) of your module.

 

To support Java 8 features, add the following to your module’s app-level Gradle file with the android setting.

 

Enter your AdMobId (in the format caapppubXXXXX~YYYYY) in the AndroidManifest.xml file.

 

If you’re using Proguard, add the following settings to a Proguard configuration file such as proguard-rules.pro.

 

To display video ads, hardware acceleration must be enabled. Add the following settings for hardware acceleration in the AndroidManifest.xml file. Adding to the application tag will use hardware acceleration for the entire application. Adding to the activity tag will use hardware acceleration only for the specific Activity where you want to display ads.

Setting Test Mode

During the development phase, enable test mode so that clicks on test ads do not incur charges to advertisers. When test mode is enabled, only test ads are displayed. In test mode, you do not need to enter the AdMob ad key in the Hive console to display test ads. Disable test mode for commercial distribution.

Kotlin

Java

Setting Hive Adiz AppID

Set the Hive Adiz AppID you registered in the Hive console AppCenter. If not set, the AndroidManifest.xml package name is used.

Kotlin

Java

Setting Hive Console Server

Set the Hive console server you want to use. The default is REAL. Even if you use the commercial server, test ads are displayed if test mode is enabled.

  • Hive test console server: ZoneType.TEST
  • Hive sandbox console server: ZoneType.SANDBOX
  • Hive commercial console server: ZoneType.REAL
Kotlin

Java

Initializing Hive Adiz

When you initialize Hive Adiz, you can receive the necessary ad keys to display ads. If test mode is enabled, you will receive a test key. If you are using the Hive SDK, proceed with Adiz initialization after calling AuthV4.setup.

Kotlin

Java

 

When initializing, the JSON file received as a callback includes a list of ad keys. The format of the ad key list is as follows:

 

If you initialize in test mode, you will receive a list of test ad keys even if you have not registered an AdMob ad key in the Hive console. If you initialize in commercial mode, you will receive a list of AdMob ad keys registered in the Hive console.

Each ad format has one ad as the default ad (an ad with "is_default":true). The first ad registered becomes the default ad for that ad format. You do not need to enter the ad key (hiveAdKey) when creating the ad instance (initialize()) for the default ad. To change the default ad, you must delete the existing default ad in the Hive console and re-register the ad.

Setting Up Ad Callback Listeners

You can receive callbacks based on the state changes of an ad by implementing the AdizListener when creating each ad instance.

Name Description Required
onLoad() Ad load successful O
onFail(error: AdizError) Failure (you can understand the reason for failure through error.getCode() and error.getMessage()) O
onShow() Ad display successful O
onClick() Ad clicked O
onPaidEvent(adRevenueData: AdRevenueData) This is a point at which a paid event is received after the ad is displayed. At this point, the ad revenue information is delivered. O
onClose() Ad closed

  • After the ad is closed, to display the same ad instance again, you need to call load() and then call show().
  • If you no longer wish to display the ad, call destroy() to remove the ad instance.
X
onRewarded(rewardItem: RewardItem) The point at which the user receives a reward after an ad display for rewarded (rewarded, rewarded interstitial) ads X
Kotlin

Java

Error Codes

The error codes and error messages for Adiz.Initialize and AdizListener when onFail() is received are as follows:

Common Codes

Number Case Explanation
0 Success Successful

Adiz Error Codes

Number Case Explanation
-1 InvalidParam Invalid parameter
-2 NotSupported Not supported
-3 InProgress Process in progress
-4 Network Network error
-5 NeedInitialize Initialization needed
-6 ResponseFail Response failed
-7 Timeout Network timeout
-99 Unknown Unknown error

Ad Platform Error Codes

Number Case Explanation
-101 NeedLoad Ad not loaded
-102 NeedReload Need to reload due to ad display time expiration
-103 NotEnoughInventory Mediation response was successful, but no filled ads due to insufficient inventory
-104 MissingAppId AppID error for mediation request
-105 InternalNetworkError Mediation network-related error
-106 InvalidUnitId Invalid Unit Id
-107 MediationNoFill Mediation adapter failed to handle ad request
-108 AlreadyLoaded Already loaded

Ad Exposure and Termination

To expose and terminate ads, follow these steps:

  1. Create ad instances from the ad class for each type of ad you want to expose. If the ad you want to expose is not a default ad, you need to enter the ad key obtained from initialization. If you do not enter the ad key (hiveAdKey), a default ad instance is created.
  2. Load (load()) the ad you want to expose.
  3. Expose (show()) the loaded ad. To re-expose the ad, you must call load() again followed by show().
  4. To terminate the ad, call destroy().

Interstitial Ads

These are full-screen ads that take up the entire screen.

Kotlin

Java

Banner Ads (Banner)

Banner ads expose a banner of a specific size. Banner ads do not receive the onClose() callback. Therefore, you must call destroy() from another location to terminate the ad.

 

BannerSize follows standard banner sizes.

Size Point (Width x Height) Description Supported Devices BannerSize Constant
320×50 Banner Mobile phones and tablets BannerSize.NORMAL
320×100 Large Banner Mobile phones and tablets BannerSize.MEDIUM
300×250 IAB Medium Rectangle Mobile phones and tablets BannerSize.LARGE
468×60 IAB Full-Size Banner Tablets BannerSize.FULL

 

PositionType is either top or bottom. The default is bottom.

Alignment Description PositionType Constant
Top Alignment Specifies alignment at the top of the screen PositionType.TOP
Bottom Alignment (Default) Specifies alignment at the bottom of the screen PositionType.BOTTOM
Kotlin

Java

Native Ads (Native)

Native ads display a specific size of the native template. Native ads are optimized for portrait screens, so it is recommended to use them in portrait games (vertical screen games). Native ads do not receive the onClose() callback. Therefore, you must call destroy() from another location to terminate the ad.

 

Currently, the templates support small or medium sizes.

Template Alignment BannerSize Constant
small size Top / Bottom BannerSize.NORMAL
medium size Center (fixed) BannerSize.MEDIUM

 

For the small template, PositionType is either top or bottom, with the default being bottom.

Alignment Description PositionType Constant
Top Alignment Specifies alignment at the top of the screen PositionType.TOP
Bottom Alignment (default) Specifies alignment at the bottom of the screen PositionType.BOTTOM

 

The medium template does not allow for selection of alignment and defaults to center alignment.

 

Kotlin

Java

Rewarded Ads (Rewarded)

These are rewarded ads where users receive rewards for watching the ad for a certain amount of time. When the reward is successfully provided, reward item information is received through the onRewarded() callback.

Kotlin

Java

Rewarded Interstitial Ads (Rewarded Interstitial)

Rewarded interstitial ads allow users to receive rewards after watching ads for a certain period. Once the reward is granted, the reward item information is received through the onRewarded() callback.

Kotlin

Java

Here’s the translated content:

App Opening Ads (AppOpen)

App opening ads display pre-loaded (load()) ads when the app status changes from background to foreground. If show() is called 3 hours after the ad is loaded, the ad will be automatically reloaded before being displayed. Once the ad is displayed at least once, it will not be automatically reloaded.

Kotlin

Java