-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
According to the docs, it's recommended to call Statsig.shutdown() when closing the app to make sure all events and logs are stored. However, such implementation causes ANR errors when the Activity is getting destroyed:
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initializeAnalytics()
// setting up activity here
}
override fun onDestroy() {
super.onDestroy()
shutdownAnalytics()
}
private fun initializeAnalytics() {
lifecycleScope.async {
Statsig.initialize(application, STATSIG_SDK_KEY, StatsigUser())
Log.d(TAG, "Statsig initialized")
}
}
private fun shutdownAnalytics() {
// Makes sure all logged events are properly flushed or saved locally
Log.d(TAG, "Shutting down Statsig…")
Statsig.shutdown()
}
// rest of the code…
}
Is this incorrect implementation or defect in 4.44.0?
aeramli
Metadata
Metadata
Assignees
Labels
No labels