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.

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

public static void setEnabled(boolean enabled)
ParameterTypeDescription
enabledbooleanSet true to enable the SDK. Set false to disable the SDK.

Disable the SDK

Call setEnabled(false) on AdTrace to stop tracking on the current device.

AdTrace.setEnabled(false);

Enable the SDK

Call setEnabled(true) to resume tracking.

AdTrace.setEnabled(true);

Check if the SDK is enabled

Call isEnabled to see whether the SDK is currently enabled.

Method signature

public static boolean isEnabled()

Example

boolean enabled = AdTrace.isEnabled();