public class

AdToApp

extends Object
  java.lang.Object
  ↳com.appintop.init.AdToApp

Class Overview

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

Summary

Nested Classes

interface AdToAppNative.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 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() Shows Interstitial advertising with automated SDK choice of the Image or Video type, depending on the given provider eCPM value
static void loadNativeAd(Activity activity, AdToAppNative.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

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 adtoapp.com website
adTypeMask Ad type bitmask, use the constants: AdToApp.MASK_IMAGE, AdToApp.MASK_VIDEO, AdToApp.MASK_INTERSTITIAL, AdToApp.MASK_REWARDED, AdToApp.MASK_NATIVE, AdToApp.MASK_BANNER. The bit sum constant can be sent: AdToApp.MASK_INTERSTITIAL | AdToApp.MASK_REWARDED | AdToApp.MASK_NATIVE | AdToApp.MASK_BANNER

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 AdToApp.MASK_IMAGE, AdToApp.MASK_VIDEO, AdToApp.MASK_INTERSTITIAL, AdToApp.MASK_REWARDED

Parameters

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

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 AdToApp.MASK_IMAGE, AdToApp.MASK_VIDEO, AdToApp.MASK_INTERSTITIAL

static void loadNativeAd(Activity activity, AdToAppNative.AdLoadListener adLoadListener)

Uploads data to display native advertising.

Parameters

activity Текущий Android Activity
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 AdToApp.INTERSTITIAL, AdToApp.IMAGE, AdToApp.VIDEO, AdToApp.REWARDED, AdToApp.NATIVE, AdToApp.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: AdToApp.MASK_IMAGE, AdToApp.MASK_VIDEO, AdToApp.MASK_INTERSTITIAL, AdToApp.MASK_REWARDED, AdToApp.MASK_NATIVE, AdToApp.MASK_BANNER. The bit sum constant can be sent: AdToApp.MASK_INTERSTITIAL | AdToApp.MASK_REWARDED | AdToApp.MASK_NATIVE | AdToApp.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

Contact support