Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d656df6

Browse files
authored
Merge pull request segmentio#5483 from segmentio/DOC-738
format and number fix
2 parents 2a6af25 + 2b40e07 commit d656df6

File tree

1 file changed

+37
-45
lines changed
  • src/connections/sources/catalog/libraries/mobile/kotlin-android

1 file changed

+37
-45
lines changed

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

+37-45
Original file line numberDiff line numberDiff line change
@@ -57,34 +57,30 @@ To get started with the Analytics-Kotlin mobile library:
5757

5858
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://central.sonatype.com/artifact/com.segment.analytics.kotlin/android/1.10.2){: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"}
5959

60-
{% codeexample %}
61-
{% codeexampletab Kotlin%}
62-
```java
60+
<br> Kotlin
61+
```java
6362
repositories {
6463
mavenCentral()
6564
}
6665
dependencies {
6766
implementation 'com.segment.analytics.kotlin:android:<latest_version>'
6867
}
69-
```
70-
{% endcodeexampletab %}
71-
{% codeexampletab Java%}
72-
```java
68+
```
69+
70+
<br> Java
71+
```java
7372
repositories {
74-
maven { url 'https://jitpack.io' }
73+
mavenCentral()
7574
}
7675
dependencies {
77-
implementation 'com.github.segmentio.analytics-kotlin:android:+'
76+
implementation 'com.segment.analytics.kotlin:android:<latest_version>'
7877
}
79-
```
80-
{% endcodeexampletab %}
81-
{% endcodeexample %}
78+
```
8279

83-
3. Initialize and configure the client. Segment recommends you to install the client in your application subclass.
80+
3. Initialize and configure the client. Segment recommends you to install the client in your application subclass.
8481

85-
{% codeexample %}
86-
{% codeexampletab Kotlin%}
87-
```java
82+
<br> Kotlin
83+
```java
8884
// Add required imports
8985
import com.segment.analytics.kotlin.android.Analytics
9086
import com.segment.analytics.kotlin.core.*
@@ -97,10 +93,9 @@ To get started with the Analytics-Kotlin mobile library:
9793
flushAt = 3
9894
flushInterval = 10
9995
}
100-
```
101-
{% endcodeexampletab %}
102-
{% codeexampletab Java%}
103-
```java
96+
```
97+
<br> Java
98+
```java
10499
AndroidAnalyticsKt.Analytics(BuildConfig.SEGMENT_WRITE_KEY, getApplicationContext(), configuration -> {
105100

106101
configuration.setFlushAt(1);
@@ -113,33 +108,30 @@ To get started with the Analytics-Kotlin mobile library:
113108

114109
JavaAnalytics analyticsCompat = new JavaAnalytics(analytics);​
115110
});
116-
```
117-
{% endcodeexampletab %}
118-
{% endcodeexample %}
111+
```
119112

120-
> warning ""
121-
> If you're on an Android platform, you must add the application context as the second parameter.
113+
**Warning:** If you're on an Android platform, you must add the application context as the second parameter.
122114
123-
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. 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.
124-
125-
<br>These are the options you can apply to configure the client:
126-
127-
Option Name | Description
128-
----------- | -----------
129-
`writeKey` *required* | This is your Segment write key. |
130-
`application` | Default set to `null`. <br> The application specific object (in the case of `Android: ApplicationContext`).
131-
`apiHost` | Default set to `api.segment.io/v1`. <br> This sets a default API Host to which Segment sends events. |
132-
`autoAddSegmentDestination` | Default set to `true`. <br> This automatically adds the Segment Destination plugin. You can set this to `false` if you want to manually add the Segment Destination plugin. |
133-
`collectDeviceId` | Default set to `false`. <br> Set to `true` to automatically collect the device Id. <br> The [DRM API](https://source.android.com/devices/drm) generates the device ID. If the ID didn't generate previously (for example, because the app was newly installed), an empty string shows before the ID generation completes. You can overwrite the device ID with a custom ID by writing your own [`plugin`](#plugin) |
134-
`defaultSettings` | Default set to `{}`. <br> The settings object used as fallback in case of network failure. |
135-
`flushAt` | Default set to `20`. <br> The count of events at which Segment flushes events. |
136-
`flushInterval` | Default set to `30` (seconds). <br> The interval in seconds at which Segment flushes events. |
137-
`flushPolicies` | undefined | Add more granular control for when to flush |
138-
`recordScreenViews` | Default set to `false`. <br> Set to `true` to automatically trigger screen events on Activity Start. |
139-
`storageProvider` | Default set to `ConcreteStorageProvider`. <br> In Android, this must be set to `AndroidStorageProvider`. The `Analytics` constructors configure this automatically. |
140-
`trackApplicationLifecycleEvents` | Default set to `false`. <br> Set to `true` to automatically track Lifecycle events. |
141-
`trackDeepLinks` | Default set to `false`. <br> Set to `true` to automatically track opened Deep Links based on intents. |
142-
`useLifecycleObserver` | Default set to `false`. <br> Set to `true` to use `LifecycleObserver` to track Application lifecycle events. |
115+
<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. 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.
116+
117+
<br>These are the options you can apply to configure the client:
118+
119+
Option Name | Description
120+
----------- | -----------
121+
`writeKey` *required* | This is your Segment write key. |
122+
`application` | Default set to `null`. <br> The application specific object (in the case of `Android: ApplicationContext`).
123+
`apiHost` | Default set to `api.segment.io/v1`. <br> This sets a default API Host to which Segment sends events. |
124+
`autoAddSegmentDestination` | Default set to `true`. <br> This automatically adds the Segment Destination plugin. You can set this to `false` if you want to manually add the Segment Destination plugin. |
125+
`collectDeviceId` | Default set to `false`. <br> Set to `true` to automatically collect the device Id. <br> The [DRM API](https://source.android.com/devices/drm) generates the device ID. If the ID didn't generate previously (for example, because the app was newly installed), an empty string shows before the ID generation completes. You can overwrite the device ID with a custom ID by writing your own [`plugin`](#plugin) |
126+
`defaultSettings` | Default set to `{}`. <br> The settings object used as fallback in case of network failure. |
127+
`flushAt` | Default set to `20`. <br> The count of events at which Segment flushes events. |
128+
`flushInterval` | Default set to `30` (seconds). <br> The interval in seconds at which Segment flushes events. |
129+
`flushPolicies` | undefined <br> Add more granular control for when to flush |
130+
`recordScreenViews` | Default set to `false`. <br> Set to `true` to automatically trigger screen events on Activity Start. |
131+
`storageProvider` | Default set to `ConcreteStorageProvider`. <br> In Android, this must be set to `AndroidStorageProvider`. The `Analytics` constructors configure this automatically. |
132+
`trackApplicationLifecycleEvents` | Default set to `false`. <br> Set to `true` to automatically track Lifecycle events. |
133+
`trackDeepLinks` | Default set to `false`. <br> Set to `true` to automatically track opened Deep Links based on intents. |
134+
`useLifecycleObserver` | Default set to `false`. <br> Set to `true` to use `LifecycleObserver` to track Application lifecycle events. |
143135

144136
4. Add Permissions to `AndroidManifest.xml`.
145137

0 commit comments

Comments
 (0)