public class

AdCel

extends Object
  java.lang.Object
  ↳co.adcel.init.AdCel

Class Overview

A class that provides static methods to initialize the SDK and display advertising.

Summary

Nested Classes

interface AdCelNative.AdLoadListener interface for event handling of native advertising display
interface InterstitialListener interface for event handling of interstitial advertising display
interface OnNativeAdsAvailabilityListener interface for event handling of native advertising initialization
class AdProvider class with ad network name constants
class TargetingParam class with targeting parameters name and values constants
class RewardedAdValues class of object Rewarded ad settings

Fields

public static final String VERSION constant version of the SDK
public static final int MASK_IMAGE bitmask constant to initialize the Image advertising
public static final int MASK_VIDEO bitmask constant to initialize the Video advertising
public static final int MASK_INTERSTITIAL bitmask constant to initialize the Interstitial (Image + Video mix) advertising
public static final int MASK_REWARDED bitmask constant to initialize the Rewarded advertising
public static final int MASK_NATIVE bitmask constant to initialize the Native advertising
public static final int MASK_BANNER bitmask constant to initialize the Banner advertising
public static final String INTERSTITIAL Advertising type constant Interstitial
public static final String IMAGE Advertising type constant Image
public static final String VIDEO Advertising type constant Video
public static final String REWARDED Advertising type constant Rewarded
public static final String NATIVE Advertising type constant Native
public static final String BANNER Advertising type constant Banner

Public Methods

static void initializeSDK(Activity activity, String sdkKey, int adTypeMask) Initializes the SDK, starts caching advertising. It's called only once when the application starts.
static void initializeSDK(Activity activity, String sdkKey, int adTypeMask, boolean startCachingImmediately) Initializes the SDK, starts caching advertising when startCachingImmediately=true. It's called only once when the application starts.
static void startCaching() Starts caching advertising
static void stopCaching() Stops caching advertising
static boolean isCachingStarted() Check caching advertising status
static void destroy() Stops AdCel SDK
static void setTestMode(Boolean testMode) Enable test mode
static boolean isTestModeEnabled() Check if test mode enabled
static void setLogging(boolean logging) Enables logging
static boolean isSDKInitialized() Checks the SDK initialization status
static boolean isLoggingEnabled() Checks whether the logging is enabled
static void showInterstitialAd(String adType) Shows only fullscreen advertising with given type
static void showInterstitialAd(String adType, String zone) Shows only fullscreen advertising with given type and zone
static void showInterstitialAd() Shows Interstitial advertising with automated SDK choice of the Image or Video type, depending on the given provider eCPM value
static void showInterstitialAdForZone(String zone) Shows Interstitial advertising with automated SDK choice of the Image or Video type, depending on the given provider eCPM value for zone
static void loadNativeAd(Context context, int count, boolean random, boolean async, AdCelNative.AdLoadListener adLoadListener) Downloads data to display native advertising
static boolean isAvailableAd(String adType) Checks the availability of the given ad type
static void setInterstitialListener( InterstitialListener interstitialListener) Installs the event listener of the full screen advertising display
static void setNativeAdsAvailabilityListener( OnNativeAdsAvailabilityListener onNativeAdsAvailabilityListener) Installs the event listener of the native advertising display
static void onPause(Activity activity) Realizes the life cycle of the android activity
static void onResume(Activity activity) Realizes the life cycle of the android activity, refreshes the link to the given Activity
static void onDestroy(Activity activity) Realizes the life cycle of the android activity
static void disableAdNetwork(int adTypeMask, String... networks) Disable ad network for ad types
static void setTargetingParam(String name, String value) Set up value for targeting parameter
static RewardedAdValues getRewardedAdValues() Return Rewarded ad settings
static void setUserConsent(Boolean userConsent) Sets GDPR users consent

Public Methods

static void initializeSDK(Activity activity, String sdkKey, int adTypeMask)

Initializes the SDK, starts caching advertising. It's called only once when the application starts. If called again, it will update the list of advertising providers priorities by ecpm values and restart advertising caching.

Parameters

activity Current Android Activity
sdkKey SDK key, received on the adcel.co website
adTypeMask Ad type bitmask, use the constants: AdCel.MASK_IMAGE, AdCel.MASK_VIDEO, AdCel.MASK_INTERSTITIAL, AdCel.MASK_REWARDED, AdCel.MASK_NATIVE, AdCel.MASK_BANNER. The bit sum constant can be sent: AdCel.MASK_INTERSTITIAL | AdCel.MASK_REWARDED | AdCel.MASK_NATIVE | AdCel.MASK_BANNER

static void initializeSDK(Activity activity, String sdkKey, int adTypeMask, boolean startCachingImmediately)

Initializes the SDK, starts caching advertising when startCachingImmediately=true. It\'s called only once when the application starts.

Parameters

activity Current Android Activity
sdkKey SDK key, received on the adcel.co website
adTypeMask Ad type bitmask, use the constants: AdCel.MASK_IMAGE, AdCel.MASK_VIDEO, AdCel.MASK_INTERSTITIAL, AdCel.MASK_REWARDED, AdCel.MASK_NATIVE, AdCel.MASK_BANNER. The bit sum constant can be sent: AdCel.MASK_INTERSTITIAL | AdCel.MASK_REWARDED | AdCel.MASK_NATIVE | AdCel.MASK_BANNER
startCachingImmediately true - starts caching, false - does not start caching

static void startCaching()

Starts caching advertising

static void stopCaching()

Stops caching advertising

static boolean isCachingStarted()

Check caching advertising status

Returns

true - caching started, false - caching stopped

static void destroy()

Stop AdCel SDK

static void setTestMode(Boolean testMode)

Enable test mode

Parameters

testMode true - enable test mode. false - disable test mode

static boolean isTestModeEnabled()

Check if test mode enabled

Returns

true - if test mode is enabled, false - test mode is disabled

static void setLogging(boolean logging)

Turns on logging

Parameters

logging true - enable log output to the console. false - disable log output to the console

static boolean isSDKInitialized()

Checks the SDK initialization status

Returns

true - if SDK was initialized, false - if method initializeSDK wasn't called at all or if was not able to connect to the server

static boolean isLoggingEnabled()

Checks whether the caching is enabled

Returns

true - if the logs output to the console is activated, false - if the logs output to the console is not activated

static void showInterstitialAd(String adType)

Shows the full screen ad with a given type. Use this method if SDK initialization was with one or more advertising type AdCel.MASK_IMAGE, AdCel.MASK_VIDEO, AdCel.MASK_INTERSTITIAL, AdCel.MASK_REWARDED

Parameters

adType advertising type. Use constants AdCel.INTERSTITIAL, AdCel.IMAGE, AdCel.VIDEO, AdCel.REWARDED

static void showInterstitialAd(String adType, String zone)

Shows the full screen ad with a given type and zone. Use this method if SDK initialization was with one or more advertising type AdCel.MASK_IMAGE, AdCel.MASK_VIDEO, AdCel.MASK_INTERSTITIAL, AdCel.MASK_REWARDED

Parameters

adType advertising type. Use constants AdCel.INTERSTITIAL, AdCel.IMAGE, AdCel.VIDEO, AdCel.REWARDED
zone Zone

static void showInterstitialAd()

Shows Interstitial ads with automatic selection of the Image or Video SDK type, depending on the provider ecom value. Use this method if SDK initialization was with one or more of advertising type AdCel.MASK_IMAGE, AdCel.MASK_VIDEO, AdCel.MASK_INTERSTITIAL

static void showInterstitialAdForZone(String zone)

Shows Interstitial ads with automatic selection of the Image or Video SDK type, depending on the provider ecom value for zone. Use this method if SDK initialization was with one or more of advertising type AdCel.MASK_IMAGE, AdCel.MASK_VIDEO, AdCel.MASK_INTERSTITIAL

Parameters

zone Zone

static void loadNativeAd(Context context, int count, boolean random, boolean async, AdCelNative.AdLoadListener adLoadListener)

Uploads data to display native advertising.

Parameters

context current Android Context
count ads count
random true - load ads from different ad networks, false - load ads only from highest ECPM available ad network
async true - onLoadAd will be called on each ad loading, false - onLoadAd will be called once when all ads loaded
adLoadListener Data download event listener for native advertising display

static boolean isAvailableAd(String adType)

Checks the given ad type availability

Parameters

adType advertsing type. Use constants AdCel.INTERSTITIAL, AdCel.IMAGE, AdCel.VIDEO, AdCel.REWARDED, AdCel.NATIVE, AdCel.BANNER

Returns

true - the given advertising type is cached and ready to show, false - the given advertising type is not ready to show

static void setInterstitialListener(InterstitialListener interstitialListener)

Installs event listeners to display full screen advertising

Parameters

interstitialListener Full screen advertising event listener

static void setNativeAdsAvailabilityListener(OnNativeAdsAvailabilityListener onNativeAdsAvailabilityListener)

Installs the event listener to display full screen advertising

Parameters

onNativeAdsAvailabilityListener Event listener of the full screen advertising display

static void onPause(Activity activity)

Realizes the android activity lifecycle. Stops data loading and data updating from whichever advertising providers possible. This method must be called in the onPause method of your activity

Parameters

activity Current Android Activity

static void onResume(Activity activity)

Realizes android activity lifecycle, refreshes the link to current Activity. This method must be called in onResume method of your activity.

Parameters

activity Current Android Activity

static void onDestroy(Activity activity)

Realizes the android activity lifecycle. Deletes all connections with current Activity from whichever advertising providers possible. This method must be called in the onDestroy method of your activity

Parameters

activity Current Android Activity

static void disableAdNetwork(int adTypeMask, String... networks)

Disable ad network for ad types. Necessary to call before SDK.

Parameters

Ad type bitmask, use the constants: AdCel.MASK_IMAGE, AdCel.MASK_VIDEO, AdCel.MASK_INTERSTITIAL, AdCel.MASK_REWARDED, AdCel.MASK_NATIVE, AdCel.MASK_BANNER. The bit sum constant can be sent: AdCel.MASK_INTERSTITIAL | AdCel.MASK_REWARDED | AdCel.MASK_NATIVE | AdCel.MASK_BANNER
networks Ad network names array, use constants of class AdProvider

static void setTargetingParam(String name, String value)

Set up value for targeting parameter.

Parameters

name Targeting parameter name. Use constants of class TargetingParam
value Targeting parameter value. For some values as TargetingParam.USER_GENDER use constants of class TargetingParam.USER_GENDER_MALE/TargetingParam.USER_GENDER_FEMALE

static RewardedAdValues getRewardedAdValues()

Return Rewarded ad settings.

Returns

RewardedAdValues - Rewarded ad settings object

static void setUserConsent(Boolean userConsent)

Sets GDPR users consent

Parameters

userConsent true - user has consent. false - user has not consent