segmentio / analytics-kotlin

The hassle-free way to add Segment analytics to your Kotlin app (Android/JVM).
MIT License
46 stars 27 forks source link

Question: Is it supported multiple instance write key? #215

Closed guiihlopes closed 8 months ago

guiihlopes commented 8 months ago

Hi, I would like to know if it's supported multiple instances with different write keys.

Currently I'm working in a single project application which has multiple contexts. Some of these contexts should send informations to worskpace1 and others to workspace2. And I couldn't find in the docs what the best practice should be to deal with this situation.

The only information I've found about this topic is for analytics-ios. And it still in a confused way, because there's two different information in each side:

image Source: https://segment.com/docs/connections/sources/catalog/libraries/mobile/apple/

image Source: https://segment.com/docs/connections/sources/catalog/libraries/mobile/ios/ios-faqs/

How could I handle this scenario which I need to split the sent informations based in a context?

wenxi-zeng commented 8 months ago

hi @guiihlopes, yes, analytics-kotlin supports multiple instances. to sent information to different workspaces, simply creates multiple analytics instance with different writeKeys.