snowplow / snowplow-android-tracker

Snowplow event tracker for Android. Add analytics to your Android apps and games
http://snowplowanalytics.com
Apache License 2.0
107 stars 63 forks source link

Set serverAnonymisation more quickly #689

Closed mscwilson closed 1 month ago

mscwilson commented 2 months ago

For issue #688

Currently, when serverAnonymisation is set in the Emitter, the whole OkHttpNetworkConnection is recreated. This is slow, so there can be a delay in setting the anonymising SP-Anonymous header.

This change sets the serverAnonymisation directly in OkHttpNetworkConnection. Now the opposite is true - some events tracked just before the flag was set can end up with the SP-Anonymous header if they're still being processed when the change is made.

NB: the CI tests for API 30 are currently failing due to flakiness. This is a known problem and will be addressed in a future PR.