AATKit Android Integration
Release Notes
  • Start
    • Setup
      • Maven
      • Prerequisites
      • Google Family Safe Apps
    • Initialization
    • Consent
      • General Handling
      • Managed Consent
        • Google CMP
        • Sourcepoint CMP
        • SFBX (AppConsent) CMP
      • Vendor Consent
      • Simple Consent
    • Plugins documentation
    • Additional Information
  • Formats
    • Introduction
    • Banner
      • Auto Load Banner
      • Multi-Size Auto Load Banner
      • Banner Cache
      • Infeed Banner
      • Sticky Banner
      • Multi-Size Banner
    • Fullscreen (Interstitial)
    • AppOpen (Google)
    • Rewarded Video
      • Server-Side Verification (SSV)
    • Native Ad
      • Basic Integration
      • Network Specifics
        • Native Ads: Google
        • Native Ads: ApplovinMax
        • Native Ads: Bluestack
        • Native Ads: FacebookAudienceNetwork
        • Native Ads: Huawei
  • Ad Networks
    • Customize Ad Networks
    • Google Mobile Ads SDK
    • AppLovinMax Ad Review
    • AppNexus special settings
    • FeedAd Shutter Colour and Disabling Spinner
    • Kidoz
  • Advanced
    • Targeting
      • Key-Value Targeting
      • User Targeting
      • Content Targeting URL
    • Frequency Capping
    • Advanced Listeners
      • Reports Delegate
      • Impression Listener (ILRD)
      • Statistics Listener
    • AATKit's Size
    • Ad Space and Fill Rate
    • Shake Debug
    • Child-directed Support
    • Geo Tracking
    • Disabling Ad Networks
    • Huawei Support
    • Creatives History
  • Other
    • AdMob Custom Events
    • Reference
      • Classes
        • AATKit
        • AATKitUserTargeting
        • CollapsibleBannerOptions
        • AATKitDebugScreenConfiguration
        • PlacementDebugInfo
        • AATKitDebugInfo
        • AATKitConfiguration
        • AATKitRuntimeConfiguration
        • ManagedConsent
        • VendorConsent
        • SimpleConsent
        • BannerConfiguration
        • BannerRequest
        • BannerCacheConfiguration
        • AATKitReward
        • NativeAdRating
        • AATKitImpression
        • PriceInfo
        • AdInfo
        • RewardedAdSSVInfo
        • PlacementHistoryInfo
        • AATKitAdNetworkOptions
          • SuperAwesomeOptions
          • FeedAdOptions
          • AppNexusOptions
          • AdMobOptions
          • DFPOptions
      • Interfaces
        • CacheStatusDelegate
        • AATKit.Delegate
        • BannerCache
        • BannerRequestCompletionListener
        • ManagedConsentDelegate
        • VendorConsentDelegate
        • Placement
        • StickyBannerPlacement
        • StickyBannerPlacementListener
        • MultiSizeBannerPlacement
        • MultiSizeBannerPlacementListener
        • InfeedBannerPlacement
        • InfeedBannerPlacementListener
        • BannerRequestDelegate
        • CacheDelegate
        • FullscreenPlacement
        • FullscreenPlacementListener
        • AppOpenAdPlacement
        • AppOpenPlacementListener
        • RewardedVideoPlacement
        • RewardedVideoPlacementListener
        • NativeAdPlacement
        • NativePlacementListener
        • NativeAdData
        • AutoLoadBannerPlacement
        • AutoLoadBannerPlacementListener
        • AutoLoadMultiSizeBannerPlacement
        • AutoLoadMultiSizeBannerPlacementListener
        • ReportsDelegate
        • ImpressionListener
        • StatisticsListener
      • Enumerations
        • AATKitGender
        • AdNetwork
        • ManagedConsentState
        • NonIABConsent
        • BannerPlacementSize
        • BannerSize
        • MediationType
        • ImpressionPricePrecisionType
  • Samples
Powered by GitBook
On this page
  • Configure AATKit
  • Handling Activity lifecycle
  • Reconfigure AATKit
  • Test Mode
  • Using an Alternative bundle ID
  • Log Levels
  1. Start

Initialization

Add, import, and configure AATKit

Last updated 2 months ago

Configure AATKit

Before loading ads, the app must initialize AATKit first. This only needs to be done once per app session, ideally at the app launch. You should call the AATKit.init(configuration) as early as possible in order to ensure optimal ad performance. We advise doing it in your application's onCreate method.

Call the initialization method with an instance which contains the necessary configuration data needed to initialize AATKit. Through , you can listen to AATKit callbacks such as obtaining mediation rules from the backend or unknown bundleID events.

AATKitConfiguration configuration = new AATKitConfiguration(this);
configuration.setDelegate(this); //optional, pass the implementation of AATKit.Delegate to listen to callbacks
AATKit.init(configuration);
val configuration = AATKitConfiguration(this)
configuration.delegate = this //optional, pass the implementation of AATKit.Delegate to listen to callbacks
AATKit.init(configuration)

Handling Activity lifecycle

It is required to pass the Activity lifecycle events to AATKit before starting to request ads from placements. You should override onResume() and onPause() methods in every Activity of your app.

Make sure to only pass lifecycle events of Activities belonging to your application. Using ActivityLifecycleCallbacks and passing lifecycle callbacks for also ad Activities (like the ones belonging to ad networks and used for presenting fullscreen ads) will cause issues.

Placements will not start loading ads before having the current activity passed to AATKit.

Notify about activity resume

@Override
protected void onResume() {
    super.onResume();
    AATKit.onActivityResume(this);
}
override protected fun onResume() {
    super.onResume()
    AATKit.onActivityResume(this)
}

Notify about activity pause

@Override
protected void onPause() {
    AATKit.onActivityPause(this);
    super.onPause();
}
override protected fun onPause() {
    AATKit.onActivityPause(this)
    super.onPause()
}

Reconfigure AATKit

AATKitRuntimeConfiguration newConfiguration = new AATKitRuntimeConfiguration();
newConfiguration.setConsentRequired(true);
newConfiguration.setConsent(new SimpleConsent(NonIABConsent.OBTAINED));
newConfiguration.setUseGeoLocation(true);
AATKit.reconfigure(newConfiguration);
val newConfiguration = AATKitRuntimeConfiguration()
newConfiguration.isConsentRequired = true
newConfiguration.consent = SimpleConsent(NonIABConsent.OBTAINED)
newConfiguration.isUseGeoLocation = true
AATKit.reconfigure(newConfiguration)

Test Mode

AATKitConfiguration configuration = new AATKitConfiguration(this);
configuration.setDelegate(this);
configuration.setTestModeAccountId(<TEST_MODE_ID>);
AATKit.init(configuration);
val configuration = AATKitConfiguration(this)
configuration.delegate = this
configuration.setTestModeAccountId(<TEST_MODE_ID>)
AATKit.init(configuration)

Make sure to remove the testModeAccountId from your AATConfiguration object, before you publish your app to the AppStore. Otherwise, your app will not earn any ad revenue.

Using an Alternative bundle ID

AATKit will do dashboard reporting using your alternative bundle ID by default if you set it.

configuration.setAlternativeBundleId("com.alternativeBundleId");

// if you still need to report on the physical bundleID call this:
// configuration.setShouldReportUsingAlternativeBundleId(false); 
configuration.setAlternativeBundleId("com.alternativeBundleId")

// if you still need to report on the physical bundleID call this:
// configuration.isShouldReportUsingAlternativeBundleId = false

Log Levels

AATKit supports the following log levels:

Verbose

Verbose-level messages are intended to capture verbose, debug, info, warning and error messages. It’s convenient in an intensive development environment.

AATKit.setLogLevel(Log.VERBOSE);
AATKit.setLogLevel(Log.VERBOSE)

Debug

Debug-level messages are intended to capture debug, info, warning and error messages. It’s convenient in a normal development environment.

AATKit.setLogLevel(Log.DEBUG);
AATKit.setLogLevel(Log.DEBUG)

Info

Info-level messages are intended to capture info, warning and error messages. Info-level may be helpful but isn’t enough for troubleshooting.

AATKit.setLogLevel(Log.INFO);
AATKit.setLogLevel(Log.INFO)

Warn

Warn-level messages are intended to capture warning and error messages only.

AATKit.setLogLevel(Log.WARN);
AATKit.setLogLevel(Log.WARN)

Error

Error-level messages are intended to capture error messages only.

AATKit.setLogLevel(Log.ERROR);
AATKit.setLogLevel(Log.ERROR)

Obtaining debug logs in already built apps

If you would want to obtain more debug logs from AATKit without recompiling the app, paste the following line:

adb shell setprop log.tag.AATKit VERBOSE

into the terminal when your testing device is attached. You can also choose different log level, like DEBUG.

AATKit enables reconfiguring it at runtime. This might be needed for some cases like reacting to consent changes or geo-location settings changes. To reconfigure AATKit, use the reconfigure public API passing an instance of .

AATKit’s test mode provides ads even before your app has been set up at Gravite. This is convenient for testing your integration. Please use your testModeAccountId to activate the test mode. Set the testModeAccountId in your object. The testModeAccountId will be sent to you via email after registering at .

Gravite recognises and identifies your app using its bundle ID. Should you need to use a different bundle ID for publishing or testing or other purposes, you can override the default bundle ID of your app by setting an "alternative bundle ID" for the object. But: before you can use the alternative bundle ID properly, please make sure that our has set up your app for the alternative bundle ID, as this is not a standard procedure.

If for any reason reporting should still be done using your app's real bundle ID, you can set the shouldReportUsingAlternativeBundleId property of the object to false.

If you decided to use an alternative bundle ID, please get in touch with our .

AATKitConfiguration
AATKit.Delegate
AATKitRuntimeConfiguration
AATKitConfiguration
Gravite
AATKitConfiguration
support
AATKitConfiguration
support