amplitude / Amplitude-Kotlin

Amplitude Kotlin SDK
MIT License
27 stars 10 forks source link

Multiple Start Session/ End Session events with 0 duration #204

Open kiko1312 opened 2 weeks ago

kiko1312 commented 2 weeks ago

Summary

Hello.

We noticed a lot of Start/End Session events with 0 or 1 second duration. Do you have any idea why is this happening? It seems like it's happening when user is not actually using his device and app, but it's initialized through notification receiving. This is a quite big issue for us. The data is wrong because user is marked as active even though he never opened the app. I think no one would expect that. Also this is generating a lot of events which are useless.

image

izaaz commented 1 week ago

@kiko1312 - do you initialize the SDK within the notification handler? The SDK itself doesn't know if it was initialized at app launch or from a notification. When initializing within a notification handler, you can turn off all default tracking so session events aren't fired.