Kotlin Android Tracker

Hey,

I am currently working on creating a Kotlin wrapper class for the existing Java snowplow android tracker?
The wrapper class/package creates a facade for tracking certain self describing events. Any recommendations for the same? (if there’s someone out there who has already done this)

I was wondering if there is a Kotlin based snowplow android tracker coming out anytime soon?

Thank you!

Hi @siv

Since the version 2.0 we worked to make our Android tracker more compatible with Kotlin based apps.
In the Kotlin official doc they say:
“Kotlin is designed with Java interoperability in mind. Existing Java code can be called from Kotlin in a natural way”.
For this reason, the Snowplow Android tracker can be considered fully compatible with Kotlin apps, though it doesn’t provide an API able to express the full power of the Kotlin language.

In term of future releases, we haven’t planned any short term rewriting of our Android tracker in Kotlin, but we are very interested to any issue you can face in term of compatibility and usability with Kotlin, as we are keen to improve the API on that front and provide more examples and docs Kotlin based (the code snippets in our official docs are still written in Java at the moment).

The wrapper class/package creates a facade for tracking certain self describing events. Any recommendations for the same?

We don’t have any particular reccomendation on this but, if you could elaborate a little more on the problems you are facing, we would be happy to provide some suggestions.

1 Like

We’re using a Kotlin wrapper / Kotlin app at the moment and haven’t run into any issues using the Android 2 tracker.

The facade one is interesting - I’m not too sure how you’d do this ahead of time (e.g., if you want types for every single property) without the tracker either pulling in or being aware of the schemas, though you could generate facades / methods if you had them available.

1 Like

Thank you Alex and Mike

I’m new to Android Development hence the compatibility doubt, thanks for the clearing that up.

We are trying to create a package where the end developer doesn’t have much control over the tracker or its configuration. All he can do is initialize the tracker using the wrapper class we provide and track certain custom events we define.

Ex: SnowplowTracker is a class where the snowplow tracker ‘tracker’ is initialized and this ‘tracker’ element is the only element the dev would use, and certain other events(self describing) will be defined and these events are the only ones the dev would track.

I hope I was able to get my thought across

That’s definitely possible - and not uncommon to essentially provide a wrapper around the Snowplow tracker without exposing the user to the internal methods of the tracker itself. You can do this in either Kotlin or Java - it shouldn’t matter too much as both will work fine with the Snowplow tracker.

2 Likes

Got it! I’ll try it out with Kotlin.
Thank you!