Skip to main content

Offline mode

By default, the Adtrace SDK sends event and session data to Adtrace servers in real time. You can put the SDK in offline mode to suspend transmission to our servers while retaining tracked data to be sent later.

While in offline mode, all information is saved in a local file on the device. When you turn offline mode off, the SDK sends that data with the correct time information.

Important

The offline mode setting is not remembered between sessions. The SDK starts in online mode every time, even if the app was closed while offline.

Be careful not to trigger too many events while the SDK is offline.

Unlike disabling the SDK, offline mode only suspends network transmission. Tracking continues locally and is sent later with the correct time information.

Offline modeDisable SDK
Data recordingContinues locallyStops completely
Network sendsSuspendedSuspended
Persists between sessionsNo, starts online each launchYes, stays disabled until re-enabled
When re-enabledSends queued data with correct timestampsDoes not replay disabled period

Method signature

public static void setOfflineMode(boolean enabled)
ParameterTypeDescription
enabledbooleanSet true to enable offline mode. Set false to return to online mode and send stored data.

Enable offline mode

Activate offline mode by calling setOfflineMode(true) on AdTrace.

AdTrace.setOfflineMode(true);

Disable offline mode

Deactivate offline mode by calling setOfflineMode(false). The SDK then sends all saved information to Adtrace servers with the correct time information.

AdTrace.setOfflineMode(false);