Skip to main content

Delay the start of the SDK

Delaying the start of the Adtrace SDK gives your app time to obtain session parameters (such as unique identifiers) before the install session is sent.

Set the initial delay in seconds with setDelayStart on your AdTraceConfig instance before you call AdTrace.onCreate(). See Configuration for how to create the config.

Method signature

public void setDelayStart(double delayStart)
ParameterTypeDescription
delayStartdoubleDelay in seconds before the SDK sends the initial install session. Maximum supported value is 10.0 seconds.

Set a startup delay

Call setDelayStart with the delay value in seconds.

config.setDelayStart(5.5);

With 5.5 seconds, the Adtrace SDK does not send the initial install session or any events created during that window.

What happens during the delay

PhaseSDK behavior
During the delayThe initial install session and any events you create are held back.
After the delay endsSession parameters are attached to the delayed install session and events, then the SDK resumes normal operation.
If you call sendFirstPackages() earlySame as when the timer expires: held data is sent and the SDK resumes immediately.
note

The startup delay applies only during the install session (the first-ever SDK initialization on a device), not on every app launch.

Resume sending early

If your session parameters are ready before the delay ends, call sendFirstPackages() to send the install session and queued events immediately.

Method signature

public static void sendFirstPackages()

Example

AdTrace.sendFirstPackages();
warning

The maximum delay start time for the Adtrace SDK is 10 seconds.

When to use this

Use delay start only when you must collect required session parameters right before the install session is sent. Keep the delay as short as possible, and call sendFirstPackages() as soon as your data is ready.