Class FlushService
-
- All Implemented Interfaces:
public final class FlushService
-
-
Constructor Summary
Constructors Constructor Description FlushService(String token, String distinctId, Boolean wifiOnly, NetworkMonitoring networkMonitor, CoroutineScope lifecycleScope, EventService eventService, String serverUrl, FlushRequest flushRequest, Long flushInterval, CoroutineDispatcher coroutineDispatcher)
-
Method Summary
Modifier and Type Method Description final StringgetReplayId()final UnitsetReplayId(String replayId)final BooleangetWifiOnly()final UnitsetWifiOnly(Boolean wifiOnly)final Unitstart()final Unitstop()final UnitflushEvents(Boolean forAll, Function0<Unit> onComplete)Flushes events from the queue. -
-
Constructor Detail
-
FlushService
FlushService(String token, String distinctId, Boolean wifiOnly, NetworkMonitoring networkMonitor, CoroutineScope lifecycleScope, EventService eventService, String serverUrl, FlushRequest flushRequest, Long flushInterval, CoroutineDispatcher coroutineDispatcher)
-
-
Method Detail
-
getReplayId
final String getReplayId()
-
setReplayId
final Unit setReplayId(String replayId)
-
getWifiOnly
final Boolean getWifiOnly()
-
setWifiOnly
final Unit setWifiOnly(Boolean wifiOnly)
-
flushEvents
final Unit flushEvents(Boolean forAll, Function0<Unit> onComplete)
Flushes events from the queue.
This function attempts to send a batch of events to the server. It respects the
wifiOnlysetting, skipping the flush if the device is not on Wi-Fi andwifiOnlyis true. The flushing process is protected by a mutex to ensure serial execution.- Parameters:
forAll- If true, attempts to flush all events currently in the queue in batches.onComplete- A callback function that will be executed on the main thread after the flush attempt (regardless of success or failure, or if the flush was skipped due to network conditions).
-
-
-
-