Mixpanel.Flush() works as expected if called anywhere in-between the game. But if I want to use it when we close the app, it doesn’t work. I’ve tried it on both Windows and Android. Nothing works.
I’ve tried calling Flush() in both of these methods provided by Unity - OnApplicationQuit and OnApplicationPause. But none of them works. And that’s because Flush() method takes time to execute, from what I can think of. And when an application is closed or paused, the execution of Flush() is also stopped instantly.
So there needs to be a way to send events when an app is closed. Otherwise, it’s just not feasible to wait 60 seconds for an event to be sent. Considering if user closes the app in-between and never opens it up again. Those events will not be recorded.