AATKit

object AATKit {

    /**
     * @return AATKit version.
     */
    @JvmStatic
    val version: String
       
    /**
     * @return AATKit detailed build version.
     */
    @JvmStatic
    val fullVersion: String

    /**
     * Initializes the AATKit library. Should be called once during application initialization before any other calls to AATKit.
     *
     * @param configuration Configuration for AATKit.
     * @see AATKitConfiguration
     */
    @JvmStatic
    fun init(configuration: AATKitConfiguration) 

    /**
     * Enables debug screen that will show after shaking the device. It is already enabled by default.
     */
    @JvmStatic
    fun enableDebugScreen() 

    /**
     * Disables the debug screen appearing after shaking the device. It is enabled by default.
     */
    @JvmStatic
    fun disableDebugScreen()

    /**
     * Used for obtaining debug information (the same that would be presented in dialog after shaking the device if debug screen is enabled)
     *
     * @return String with debug information
     */
    @JvmStatic
    val debugInfo: String
      
    /**
     * Allows to reconfigure the options for GDPR consent.
     *
     * @param configuration New configuration.
     */
    @JvmStatic
    fun reconfigure(configuration: AATKitRuntimeConfiguration)

    /**
     * Checks if AATKit recognizes given device as tablet.
     *
     * @param context The [Context] of your application.
     * @return True if device is recognized as tablet, false otherwise.
     */
    @JvmStatic
    fun isTablet(context: Context): Boolean

    /**
     * Returns the [BannerPlacementSize] with maximum width that will fit on a given device in portrait screen orientation.
     *
     * @param context The [Context] of your application.
     * @return [BannerPlacementSize] best fitting current device
     */
    @JvmStatic
    fun maximumBannerSizePortrait(context: Context): BannerPlacementSize 

    /**
     * Returns the [BannerPlacementSize] with maximum width that will fit on a given device in landscape screen orientation.
     *
     * @param context The [Context] of your application.
     * @return [BannerPlacementSize] best fitting current device
     */
    @JvmStatic
    fun maximumBannerSizeLandscape(context: Context): BannerPlacementSize

    /**
     * Returns the set of [BannerSize] that will fit on a given device in portrait screen orientation.
     *
     * @param context The [Context] of your application.
     * @return Set of [BannerSize] fitting current device
     */
    @JvmStatic
    fun fittingBannerSizesPortrait(context: Context): Set<BannerSize>

    /**
     * Returns the set of [BannerSize] that will fit on a given device in landscape screen orientation.
     *
     * @param context The [Context] of your application.
     * @return Set of [BannerSize] fitting current device
     */
    @JvmStatic
    fun fittingBannerSizesLandscape(context: Context): Set<BannerSize>

    /**
     * Notifies AATKit about activity resume. Invoke this method in every activity that uses AATKit.
     *
     * @param activity Reference to [Activity].
     */
    @JvmStatic
    fun onActivityResume(activity: Activity)

    /**
     * Notifies AATKit about activity pause. Invoke this method in every activity that uses AATKit.
     *
     * @param activity Reference to [Activity].
     */
    @JvmStatic
    fun onActivityPause(activity: Activity)

    /**
     * Creates a new fullscreen placement. If the fullscreen placement of given name already exists, it will be returned.
     *
     * @param name Unique name of placement. The same name will be used in addapptr.com account.
     * @return FullscreenPlacement instance, or null if placement cannot be created.
     */
    @JvmStatic
    fun createFullscreenPlacement(name: String): FullscreenPlacement?

    /**
     * Creates a new  infeed banner placement. If the banner placement of given name already exists, it will be returned.
     *
     *
     * **The placement will create a copy of the
     * configuration.** Any changes made to the configuration after placement is created will be ignored.
     *
     * @param name          Unique name of placement. The same name will be used in addapptr.com account.
     * @param configuration The configuration for this placement. The placement will ignore any changes made to configuration after it was created.
     * @return Infeed banner placement instance, or null if the placement cannot be created.
     */
    @JvmStatic
    fun createInfeedBannerPlacement(
        name: String,
        configuration: BannerConfiguration?
    ): InfeedBannerPlacement?

    /**
     * Creates a new sticky banner placement. If the banner placement of given name already exists, it will be returned.
     *
     * @param name               Unique name of placement. The same name will be used in addapptr.com account.
     * @param bannerPlacementSize Size of the sticky banner placement.
     * @return Sticky banner placement instance, or null if the placement cannot be created.
     */
    @JvmStatic
    fun createStickyBannerPlacement(
        name: String,
        bannerPlacementSize: BannerPlacementSize
    ): StickyBannerPlacement?

    /**
     * Creates a new multisize banner placement. If the banner placement of given name already exists, it will be returned.
     *
     * @param name               Unique name of placement. The same name will be used in addapptr.com account.
     * @return Multisize banner placement instance, or null if the placement cannot be created.
     */
    @JvmStatic
    fun createMultiSizeBannerPlacement(name: String): MultiSizeBannerPlacement?

    /**
     * Creates a new automatically loading banner placement. If the banner placement of given name and size already exists, it will be returned.
     *
     * @param name               Unique name of placement. The same name will be used in addapptr.com account.
     * @param bannerPlacementSize Size of the sticky banner placement.
     * @return AutoLoadBannerPlacement instance, or null if the placement cannot be created.
     */
    @JvmStatic
    fun createAutoLoadBannerPlacement(
        name: String,
        bannerPlacementSize: BannerPlacementSize
    ): AutoLoadBannerPlacement? 

    /**
     * Creates a new automatically loading multisize banner placement. If the banner placement of given name already exists, it will be returned.
     *
     * @param name               Unique name of placement. The same name will be used in addapptr.com account.
     * @return AutoLoadMultiSizeBannerPlacement instance, or null if the placement cannot be created.
     */
    @JvmStatic
    fun createAutoLoadMultiSizeBannerPlacement(name: String): AutoLoadMultiSizeBannerPlacement?

    /**
     * Creates a new rewarded video placement. If the rewarded video ad placement of given name already exists, it will be returned.
     *
     * @param name Unique name of placement. The same name will be used in addapptr.com account.
     * @return Rewarded video placement instance, or null if the placement cannot be created.
     */
    @JvmStatic
    fun createRewardedVideoPlacement(name: String): RewardedVideoPlacement?

    /**
     * Creates a new native ad placement. If the native ad placement of given name already exists, it will be returned.
     *
     * @param name              Unique name of placement. The same name will be used in addapptr.com account.
     * @param supportsMainImage True if the native ads returned should have main image asset. Keep in mind that if main image is used, it has to be displayed.
     * @return NativeAd placement instance, or null if the placement cannot be created.
     */
    @JvmStatic
    fun createNativeAdPlacement(name: String, supportsMainImage: Boolean): NativeAdPlacement?

    /**
     * Creates a new App Open Ad placement. If the App Open Ad placement of given name already exists, it will be returned.
     *
     * @param name Unique name of placement. The same name will be used in addapptr.com account.
     * @return App Open Ad placement instance, or null if the placement cannot be created.
     */
    @JvmStatic
    fun createAppOpenAdPlacement(name: String): AppOpenAdPlacement?

    /**
     * Creates a cache of automatically preloaded banner ads. The cache will always try to have a defined amount of banners available for immediate handout to the app whenever they are needed.
     * **The BannerCache needs to be destroyed when no longer needed.**
     *
     * @param configuration [BannerCacheConfiguration] instance used to configure the cache.
     */
    @JvmStatic
    fun createBannerCache(configuration: BannerCacheConfiguration): BannerCache?

    /**
     * Allows to set the desired position of AdChoices icon in Google native ads. Set null to use the ad network's default.
     *
     * @param position desired AdChoices icon position. Null by default.
     */
    @JvmStatic
    fun setAdChoicesIconPosition(position: AdChoicesIconPosition?)

    /**
     * Allows to enable or disable selected ad networks. By default all networks are enabled.
     *
     * @param network Ad network.
     * @param enabled True to enable, false to disable.
     */
    @JvmStatic
    fun setNetworkEnabled(network: AdNetwork, enabled: Boolean) 

    /**
     * Returns true if ad network is enabled, false otherwise.
     *
     * @param network Ad network.
     * @return True if ad network is enabled, false otherwise.
     */
    @JvmStatic
    fun isNetworkEnabled(network: AdNetwork): Boolean 

    /**
     * Get option from AATKit. Options can be obtained from the server or set using the [setOption] method.
     *
     * @param optionName The name of the option to be checked.
     * @return Value of the option or null if it is not set.
     */
    @JvmStatic
    fun getOption(optionName: String): String? 

    /**
     * Convenience method for checking if option is enabled in AATKit. Options can be obtained from the server or set using the [setOption] method.
     *
     * @param optionName The name of the option to be checked.
     * @return True if option value is "Yes", false otherwise.
     */
    @JvmStatic
    fun isOptionEnabled(optionName: String): Boolean

    /**
     * Set option in AATKit. Options can also be obtained from the server.
     *
     * @param optionName  The name of the option to be set.
     * @param optionValue The value of the option to be set.
     */
    @JvmStatic
    fun setOption(optionName: String, optionValue: String) 

    /**
     * Allows to pass PublisherProvidedId to networks supporting it.
     */
    @JvmStatic
    fun setPublisherProvidedId(publisherProvidedId: String)

    /**
     * Checks if consent is of opt-in type (like GDPR) or not
     */
    @JvmStatic
    fun isConsentOptIn(): Boolean

    @JvmStatic
    fun setRewardedAdSSVInfo(info: RewardedAdSSVInfo)

    /**
     * Sets the targeting information for the application. This information will be used only if no placement-specific targeting is available.
     *
     * @param info Map with targeting information
     * @see .setTargetingInfo
     */
    @JvmStatic
    fun setTargetingInfo(info: Map<String, List<String>>?)

    /**
     * Sets the content targeting url for the application. This information will be used only if no placement-specific targeting is available.
     *
     * @param targetingUrl The targeting url
     * @see .setContentTargetingUrl
     */
    @JvmStatic
    fun setContentTargetingUrl(targetingUrl: String)

    /**
     * Adds an ad network to the list of ad networks that receive targeting keywords (if any set).
     * If no ad networks are added, any set keywords will be delivered to all ad networks supporting keyword targeting.
     *
     * @param network Chosen ad network.
     */
    @JvmStatic
    fun addAdNetworkForKeywordTargeting(network: AdNetwork)

    /**
     * Removes an ad network from the list of ad networks that receive targeting keywords (if any set).
     * If no ad networks are added to the list, any set keywords will be delivered to all ad networks supporting keyword targeting.
     *
     * @param network Chosen ad network.
     */
    @JvmStatic
    fun removeAdNetworkForKeywordTargeting(network: AdNetwork)

    /**
     * Allows to set log level from code.
     *
     * @param logLevel Desired log level, as in [android.util.Log] class.
     */
    @JvmStatic
    fun setLogLevel(logLevel: Int)

    /**
     * Returns the log level used by AATKit.
     * Note that the used log level does not have to come from [setLogLevel], as it can also be influenced by server configs and `adb shell setprop` method.
     */
    @JvmStatic
    fun getLogLevel(): Int

    /**
     * Allows to set if app should be treated as child-directed.
     *
     * @param isChildDirected True if app is child directed, false otherwise.
     */
    @JvmStatic
    fun setIsChildDirected(isChildDirected: Boolean)

    /**
     * Allows to mute video ads.
     *
     * @param mute True to enable, false to disable ad muting.
     */
    @JvmStatic
    fun muteVideoAds(mute: Boolean)

    /**
     * Used to configure the debug screen presentation
     */
    @JvmStatic
    fun configureDebugScreen(configuration: AATKitDebugScreenConfiguration)

    /**
     * Used for obtaining debug information (the same that would be presented in dialog after shaking the device if debug screen is enabled)
     *
     * @return AATKit debug info.
     */
    @JvmStatic
    fun getDebugInfoObject(): AATKitDebugInfo?

    /**
     * Shows AATKit debug screen.
     */
    @JvmStatic
    fun showDebugDialog()

}

Last updated