Skip to content

Commit 923c5a9

Browse files
authored
Merge pull request segmentio#169 from segmentio/repo-sync
repo sync
2 parents d20b846 + 6d7f20b commit 923c5a9

File tree

1 file changed

+14
-7
lines changed
  • src/connections/sources/catalog/libraries/mobile/kotlin-android

1 file changed

+14
-7
lines changed

src/connections/sources/catalog/libraries/mobile/kotlin-android/index.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ To get started with the Analytics-Kotlin mobile library:
2525
2. Search for **Kotlin (Android)** and click **Add source**.
2626
2. Add the Analytics dependency to your build.gradle.
2727

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"}
2929

3030
```
3131
repositories {
32-
maven { url 'https://jitpack.io' }
32+
mavenCentral()
3333
}
3434
dependencies {
35-
implementation 'com.github.segmentio.analytics-kotlin:android:+'
35+
implementation 'com.segment.analytics.kotlin:android:<latest_version>'
3636
}
3737
```
3838
@@ -42,6 +42,7 @@ To get started with the Analytics-Kotlin mobile library:
4242
4343
```java
4444
// 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.
4546
Analytics("YOUR_WRITE_KEY", applicationContext) {
4647
// Automatically track Lifecycle events
4748
trackApplicationLifecycleEvents = true
@@ -50,7 +51,8 @@ To get started with the Analytics-Kotlin mobile library:
5051
}
5152
```
5253
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.
5456
5557
<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.
5658
@@ -67,7 +69,7 @@ To get started with the Analytics-Kotlin mobile library:
6769
`flushAt` | Default set to `20`. <br> The count of events at which Segment flushes events. |
6870
`flushInterval` | Default set to `30` (seconds). <br> The interval in seconds at which Segment flushes events. |
6971
`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. |
7173
`trackApplicationLifecycleEvents` | Default set to `false`. <br> Set to `true` to automatically track Lifecycle events. |
7274
`trackDeepLinks` | Default set to `false`. <br> Set to `true` to automatically track opened Deep Links based on intents. |
7375
`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:
8082
<!-- Required for internet. -->
8183
<uses-permission android:name="android.permission.INTERNET"/>
8284
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
83-
<!-- Required to compute device Id, not providing this will not break your implementation -->
84-
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
8585
```
8686
87+
5. Enable Java 8+ API desugaring.
88+
89+
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+
8791
## Tracking Methods
8892
8993
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:
440444

441445
Segment recommends you to test your destination implementation end-to-end. Send some sample analytics events and ensure that they reach the destination.
442446

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+
443450
## Changelog
444451
[View the Analytics-Kotlin changelog on GitHub](https://github.com/segmentio/analytics-kotlin/releases).

0 commit comments

Comments
 (0)