[Android] Session Duration returns 0 and has no event (Ghost Session)
Hi Countly team,
I am facing an issue that some sessions are returns no duration value and no event. My current version is 22.06.0
After investigation, I think the root cause is beginSessionInternal function is called 2 times in the row when opening app in the first time.
1. When setting up the Consents -> onConsentChanged() func is called -> beginSessionInternal() is called.
2. When starting an activity -> countly.onStart(activity) is called -> beginSessionInternal() is called.
After that, the app works fine without any ghost sessions.
Can you help me how to resolve this problem?
Thank you in advance.
Comments
Hello, could you share your SDK initialization code that reproduces the issue?
Note that there is no ghost session on Countly version 20.11.11
Yes, sure
And I also call
every time going to the onStart() and onStop() of an activity.
Hello, in this case the issue should be fixed if you would give the consent as part of the config object and not with a separate call right after init. Something like this:
https://github.com/Countly/countly-sdk-android/blob/master/app/src/main/java/ly/count/android/demo/App.java#L195-L200
yes, It works perfectly. Thanks for your support.
Please sign in to leave a comment.