Initialization

Add, import, and configure AATKit

Configure AATKit

Before loading ads, the app must initialize AATKit first. This only needs to be done once, ideally at the app launch. You should call the initAATKit(with configuration: AATConfiguration?) as early as possible in order to ensure optimal ad performance.

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

let configuration = AATConfiguration()
configuration.delegate = self
AATSDK.initAATKit(with: configuration)

You can add some extra configurations for some ad networks using AATAdNetworksOptions. For more information, see Ad Networks section.

Reconfigure AATKit

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 AATRuntimeConfiguration.

let newConfiguration = AATRuntimeConfiguration()
newConfiguration.consentRequired = true
newConfiguration.consent = AATSimpleConsent(nonIABConsent: .obtained)
newConfiguration.isUseGeoLocation = true
AATSDK.reconfigure(configuration: newConfiguration)

Test Mode

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 AATConfiguration object. The testModeAccountId will be sent to you via email after registering at Gravite.

let configuration = AATConfiguration()
configuration.delegate = self
configuration.testModeAccountId = <TEST_MODE_ID>
AATSDK.initAATKit(with: 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

Gravite recognizes 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 AATConfiguration object. But: before you can use the alternative bundle ID properly, please make sure that our support has set up your app for the alternative bundle ID, as this is not a standard procedure.

AATKit will do dashboard reporting using your alternative bundle ID by default if you set it. To report using your app's real bundle Id, you can set the shouldReportUsingAlternativeBundleId property of the AATConfiguration object to false.

configuration.alternativeBundleId = "com.alternativeBundleID"

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

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

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.

AATSDK.setLogLevel(logLevel: .verbose)

Debug

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

AATSDK.setLogLevel(logLevel: .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.

AATSDK.setLogLevel(logLevel: .info)

Warn

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

AATSDK.setLogLevel(logLevel: .warn)

Error

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

AATSDK.setLogLevel(logLevel: .error)

Last updated