matomo-org / matomo-sdk-ios

Matomo iOS, tvOS and macOS SDK: a Matomo tracker written in Swift
MIT License
388 stars 164 forks source link

Add better better support for sending events in the background #359

Open brototyp opened 4 years ago

brototyp commented 4 years ago

This PR tries to fix issues (#331, #327) when bringing the app to the background, while dispatching events.

There are multiple approaches.

  1. Ensure retransmission of the same event doesn't lead to duplicate events in the backend. This requires changes on the backend side.
  2. Uploading events using a background URLSession. Downside of this approach is that a background session doesn't guarantee timely execution of the request and doesn't give us too much / enough control over how requests are sent or re-sent.
  3. Starting a background task before transmitting and ending it right after. This is the approach taken in this PR:
brototyp-bot commented 4 years ago
1 Error
:no_entry_sign: Please add a line to the CHANGELOG.md since you changed the SDK.
1 Warning
:warning: Are there any changes that should be explained in the README.md?

Generated by :no_entry_sign: Danger