Skip to main content

Disable or enable the SDK

By default, the Adtrace SDK runs when your app is open. You can disable and re-enable the SDK to pause and resume recording. When the SDK is disabled, it does not send any data to Adtrace servers.

Important

You can only call setEnabled after the first session. This setting persists between sessions. If you disable the SDK, it stays disabled until you enable it again.

Calls to setEnabled before appDidLaunch are ignored. Initialize the SDK first, then toggle tracking.

Unlike offline mode, disabling the SDK stops tracking completely. No data is recorded while the SDK is disabled.

Disable SDKOffline mode
Data recordingStops completelyContinues locally
Network sendsSuspendedSuspended
Persists between sessionsYes, stays disabled until re-enabledNo, starts online each launch
When re-enabledDoes not replay disabled periodSends queued data with correct timestamps

Method signature

+ (void)setEnabled:(BOOL)enabled;
ParameterTypeDescription
enabledBOOLSet YES / true to enable the SDK. Set NO / false to disable the SDK.

Disable the SDK

Call setEnabled with NO / false on Adtrace to stop tracking on the current device.

[Adtrace setEnabled:NO];

Enable the SDK

Call setEnabled with YES / true to resume tracking.

[Adtrace setEnabled:YES];

Check if the SDK is enabled

Call isEnabled to see whether the SDK is currently enabled.

Method signature

+ (BOOL)isEnabled;

Returns YES / true when the SDK is enabled, or NO / false when it is disabled.

Example

BOOL enabled = [Adtrace isEnabled];