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.
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 mode | Disable SDK | |
|---|---|---|
| Data recording | Continues locally | Stops completely |
| Network sends | Suspended | Suspended |
| Persists between sessions | No, starts online each launch | Yes, stays disabled until re-enabled |
| When re-enabled | Sends queued data with correct timestamps | Does not replay disabled period |
Method signature
public static void setOfflineMode(boolean enabled)
| Parameter | Type | Description |
|---|---|---|
enabled | boolean | Set 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.
- Java
- Kotlin
- Javascript
AdTrace.setOfflineMode(true);
AdTrace.setOfflineMode(true)
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.
- Java
- Kotlin
- Javascript
AdTrace.setOfflineMode(false);
AdTrace.setOfflineMode(false)
AdTrace.setOfflineMode(false);