Closed arlyxiao closed 1 month ago
hi @arlyxiao, these two functions PendingUploads
and PurgeStorage
are utility functions for people who wanna control the storage themselves. the SDK itself does not use these two functions for flush. if you want to flush the events before purge, simple do
analytics.Flush(); // flush events
analytics.PurgeStorage(); // remove damaged files that can't be flushed
the functions only do what it intends to do. Flush
for flushing. Purge
for cleaning.
if you want to flush at app launch, see this StartupPolicy for example.
The function PendingUpload will be called when initialized analytics. And then remove the file without sending the events.
Why not send the events when initialize analytics? If it only removes files without sending events. These events will be lost. This doesn't make sense.
In my use case, It should flush all old temporary before purge whatever the scenario is.