The problem was caused when the app goes to background with zero events in the eventQueue. In that case we start the bg task, but do not end end it.
The PR:
adds a check to flush method,
makes taskIdentifier thread-safe
moves initialization of bg task to from UIApplicationDidEnterBackgroundNotification notification to flush method, so a task will be spawned on each attempt to send events.
Fixes #336.
The problem was caused when the app goes to background with zero events in the eventQueue. In that case we start the bg task, but do not end end it.
The PR:
flush
method,UIApplicationDidEnterBackgroundNotification
notification toflush
method, so a task will be spawned on each attempt to send events.