Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do we get access to sessionId? #352

Open
swlabrtyr opened this issue Feb 8, 2023 · 5 comments
Open

How do we get access to sessionId? #352

swlabrtyr opened this issue Feb 8, 2023 · 5 comments

Comments

@swlabrtyr
Copy link

In the new Amplitude SDK doc, it says sessionId is a property of the Amplitude() object, and can be accessed accordingly -> amplitude.sessionId https://www.docs.developers.amplitude.com/data/sdks/android-kotlin/#user-sessions
However, I have found that this is not true. sessionId appears to live inside the EventOptions() object. How can developers access sessionId (and other user params ie device, location etc.) from the EventOptions? Or is it possible to access sessionId some other way?

I am using SDK version analytics-android:1.6.0

@qingzhuozhen
Copy link
Contributor

Hi @swlabrtyr, thanks for reporting this! Sorry for this issue, I believe this is due to our earlier fix around sessions. We would dive in more and take care of this. The EventOptions object is actually part of the event and you can use this to set other params easily. The event object would include the current sessionId can be retrieved via a custom plugin. This could be a temporary workaround.

@swlabrtyr
Copy link
Author

Hi @qingzhuozhen thanks for your reply! How would I use this custom plugin? When accessing EventOptios directly all items are null. I assume I need to pass this object to Amplitude or some other class, please advise 🙏🏻

@qingzhuozhen
Copy link
Contributor

Hi @swlabrtyr The custom plugin way is not super ideal and we just release a fix to enable the way described in the dev doc. Feel free to upgrade and let us know if that's still an issue for you.

@swlabrtyr
Copy link
Author

Hi @qingzhuozhen thank you, 1.6.2 gives me access. I appreciate your assistance 🙏🏻 . I have one question, in the previous sdk there was a method setOffline that when set to true would not send events to Amplitude's servers. I no longer see a similar method in the documentation for the Kotlin SDK. Is there a flag/method we can call to disable sending of events to Amplitude? We use this for testing purposes. Thank you again!

@qingzhuozhen
Copy link
Contributor

Hi @swlabrtyr, thanks for the update! Yeah, unfortunately, the offline option is not covered yet, I will discuss with the team about the support for it. For testing purposes, would optOut work for you? That's going to block any event sent to Amplitude.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants