() {
+ @Override
+ public Unit invoke() {
+ flushEvents();
+ return Unit.INSTANCE;
+ }
+ }, flushInterval * 1000L,
ParselyCoroutineScopeKt.getSdkScope());
inMemoryBuffer = new InMemoryBuffer(ParselyCoroutineScopeKt.getSdkScope(), localStorageRepository, () -> {
if (!flushTimerIsActive()) {
@@ -85,14 +87,13 @@ protected ParselyTracker(String siteId, int flushInterval, Context c) {
}
return Unit.INSTANCE;
});
+ flushQueue = new FlushQueue(flushManager, localStorageRepository, new ParselyAPIConnection(ROOT_URL + "mobileproxy"), ParselyCoroutineScopeKt.getSdkScope());
// get the adkey straight away on instantiation
timer = new Timer();
isDebug = false;
- if (localStorageRepository.getStoredQueue().size() > 0) {
- startFlushTimer();
- }
+ flushManager.start();
ProcessLifecycleOwner.get().getLifecycle().addObserver(
(LifecycleEventObserver) (lifecycleOwner, event) -> {
@@ -428,34 +429,6 @@ public void flushEventQueue() {
// no-op
}
- /**
- * Send the batched event request to Parsely.
- *
- * Creates a POST request containing the JSON encoding of the event queue.
- * Sends this request to Parse.ly servers.
- *
- * @param events The list of event dictionaries to serialize
- */
- private void sendBatchRequest(ArrayList