You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/connections/sources/catalog/libraries/mobile/kotlin-android/index.md
+14-7Lines changed: 14 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -25,14 +25,14 @@ To get started with the Analytics-Kotlin mobile library:
25
25
2. Search for **Kotlin (Android)** and click **Add source**.
26
26
2. Add the Analytics dependency to your build.gradle.
27
27
28
-
Segment recommends you to install the library with a build system like Gradle, as it simplifies the process of upgrading versions and adding integrations. The library is distributed through [Jitpack](https://jitpack.io/){:target="_blank"}. Add the analytics module to your build.gradle as a dependency as shown in the code sample below.
28
+
Segment recommends you to install the library with a build system like Gradle, as it simplifies the process of upgrading versions and adding integrations. The library is distributed through [Maven Central](https://repo1.maven.org/maven2/com/segment/analytics/kotlin/android/){:target="_blank"}. Add the analytics module to your build.gradle as a dependency as shown in the code sample below, and replace `<latest_version>` with the latest version listed on Segment's [releases page](https://github.com/segmentio/analytics-kotlin/releases){:target="_blank"}
@@ -42,6 +42,7 @@ To get started with the Analytics-Kotlin mobile library:
42
42
43
43
```java
44
44
// Create an analytics client with the given application context and Segment write key.
45
+
// NOTE: in android, application context is required to pass as the second parameter.
45
46
Analytics("YOUR_WRITE_KEY", applicationContext) {
46
47
// Automatically track Lifecycle events
47
48
trackApplicationLifecycleEvents = true
@@ -50,7 +51,8 @@ To get started with the Analytics-Kotlin mobile library:
50
51
}
51
52
```
52
53
53
-
Automatically tracking lifecycle events (`Application Opened`, `Application Installed`, `Application Updated`) is optional, but Segment highly recommends you to configure these options in order to track core events.
54
+
**Note: If you're on an Android platform, you must add the application context as the second parameter.**
55
+
<br>Automatically tracking lifecycle events (`Application Opened`, `Application Installed`, `Application Updated`) is optional, but Segment highly recommends you to configure these options in order to track core events.
54
56
55
57
<br>**Note:** Unlike the Analytics-Android SDK, the Analytics-Kotlin SDK doesn’t provide a singleton instance and relies on you to keep track of the instance.
56
58
@@ -67,7 +69,7 @@ To get started with the Analytics-Kotlin mobile library:
67
69
`flushAt` | Default set to `20`. <br> The count of events at which Segment flushes events. |
68
70
`flushInterval` | Default set to `30` (seconds). <br> The interval in seconds at which Segment flushes events. |
69
71
`recordScreenViews` | Default set to `false`. <br> Set to `true` to automatically trigger screen events on Activity Start. |
70
-
`storageProvider` | Default set to `ConcreteStorageProvider`. <br> The provider for storage class. It’s best not to modify this as it can disrupt your storage logic and you won’t be able to correctly store events. |
72
+
`storageProvider` | Default set to `ConcreteStorageProvider`. <br> In Android, this must be set to `AndroidStorageProvider`. The `Analytics` constructors configure this automatically. |
71
73
`trackApplicationLifecycleEvents` | Default set to `false`. <br> Set to `true` to automatically track Lifecycle events. |
72
74
`trackDeepLinks` | Default set to `false`. <br> Set to `true` to automatically track opened Deep Links based on intents. |
73
75
`useLifecycleObserver` | Default set to `false`. <br> Set to `true` to use `LifecycleObserver` to track Application lifecycle events. |
@@ -80,10 +82,12 @@ To get started with the Analytics-Kotlin mobile library:
The SDK internally uses a number of Java 8 language APIs through desugaring. Make sure your project either [enables desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring)) or requires a minimum API level of 26.
90
+
87
91
## Tracking Methods
88
92
89
93
Once you’ve installed the mobile or server Analytics-Kotlin library, you can start collecting data through Segment’s tracking methods:
@@ -440,5 +444,8 @@ To test your destination:
440
444
441
445
Segment recommends you to test your destination implementation end-to-end. Send some sample analytics events and ensure that they reach the destination.
442
446
447
+
## Compatibility
448
+
If you use a Java codebase, please refer to the [Java Compatibility docs](https://github.com/segmentio/analytics-kotlin/blob/main/JAVA_COMPAT.md){:target="_blank"} for sample uses.
449
+
443
450
## Changelog
444
451
[View the Analytics-Kotlin changelog on GitHub](https://github.com/segmentio/analytics-kotlin/releases).
0 commit comments