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 ADTConfig instance before you call [Adtrace appDidLaunch:] / Adtrace.appDidLaunch(...). See Configuration for how to create the config.
Method signature
- (void)setDelayStart:(double)delayStart;
You can also assign the delayStart property directly on ADTConfig.
| Parameter | Type | Description |
|---|---|---|
delayStart | double | Delay in seconds before the SDK sends the initial install session. Maximum supported value is 10.0 seconds. |
Set a startup delay
- Objective-C
- Swift
- Javascript
[adtraceConfig setDelayStart:5.5];
Or assign the property:
adtraceConfig.delayStart = 5.5;
adtraceConfig?.delayStart = 5.5
adtraceConfig.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
| Phase | SDK behavior |
|---|---|
| During the delay | The initial install session and any events you create are held back. |
| After the delay ends | Session parameters are attached to the delayed install session and events, then the SDK resumes normal operation. |
If you call sendFirstPackages early | Same as when the timer expires: held data is sent and the SDK resumes immediately. |
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
+ (void)sendFirstPackages;
Example
- Objective-C
- Swift
- Javascript
[Adtrace sendFirstPackages];
Adtrace.sendFirstPackages()
Adtrace.sendFirstPackages();
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.
If session parameters are available before launch, prefer setting them with Set session callback parameters before appDidLaunch instead of delaying the SDK.