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.
Calls to setOfflineMode before appDidLaunch are ignored. Initialize the SDK first, then toggle offline mode.
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
+ (void)setOfflineMode:(BOOL)enabled;
| Parameter | Type | Description |
|---|---|---|
enabled | BOOL | Set YES / true to enable offline mode. Set NO / false to return to online mode and send stored data. |
Enable offline mode
Activate offline mode by calling setOfflineMode with YES / true on Adtrace.
- Objective-C
- Swift
- Javascript
[Adtrace setOfflineMode:YES];
Adtrace.setOfflineMode(true)
Adtrace.setOfflineMode(true);
Disable offline mode
Deactivate offline mode by calling setOfflineMode with NO / false. The SDK then sends all saved information to Adtrace servers with the correct time information.
- Objective-C
- Swift
- Javascript
[Adtrace setOfflineMode:NO];
Adtrace.setOfflineMode(false)
Adtrace.setOfflineMode(false);