Skip to content

Commit d840a24

Browse files
committed
use instance instead of shared
1 parent 4b81f3e commit d840a24

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

README.md

+16-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,22 @@ Instrument your apps with Aptabase, an Open Source, Privacy-First and Simple Ana
66

77
## Install
88

9-
Add the following dependency to your app's build.gradle file:
9+
Aptabase SDK is available through JitPack, to install it add the following line repository to your root build.gradle file:
10+
11+
```gradle
12+
allprojects {
13+
repositories {
14+
...
15+
maven { url 'https://jitpack.io' }
16+
}
17+
}
18+
```
19+
20+
And then add the following dependency:
1021

1122
```gradle
1223
dependencies {
13-
implementation 'com.aptabase:aptabase:0.0.1'
24+
implementation 'com.github.aptabase:aptabase-kotlin:0.0.2'
1425
}
1526
```
1627

@@ -27,7 +38,7 @@ class MainActivity : AppCompatActivity() {
2738
override fun onCreate(savedInstanceState: Bundle?) {
2839
// ...
2940
val context = this
30-
Aptabase.shared.initialize(context, "<api-key>")
41+
Aptabase.instance.initialize(context, "<YOUR_APP_KEY>"); // 👈 this is where you enter your App Key
3142
}
3243
}
3344
```
@@ -37,8 +48,8 @@ Afterwards you can start tracking events with `trackEvent`:
3748
```kotlin
3849
import com.aptabase.Aptabase
3950

40-
Aptabase.shared.trackEvent("connect_click"); // An event with no properties
41-
Aptabase.shared.trackEvent("play_music", mapOf<String, Any>( // An event with a custom property
51+
Aptabase.instance.trackEvent("connect_click"); // An event with no properties
52+
Aptabase.instance.trackEvent("play_music", mapOf<String, Any>( // An event with a custom property
4253
"name" to "here_comes_the_sun" )
4354
)
4455
```

aptabase/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ publishing {
4747
release(MavenPublication) {
4848
groupId = 'com.aptabase'
4949
artifactId = 'aptabase'
50-
version = '0.0.0'
50+
version = '0.0.2'
5151

5252
afterEvaluate {
5353
from components.release

aptabase/src/main/java/com/aptabase/Aptabase.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import java.util.concurrent.TimeUnit
1616
import java.util.concurrent.Executors
1717

1818
class Aptabase private constructor() {
19-
private val SDK_VERSION = "[email protected].1"
19+
private val SDK_VERSION = "[email protected].2"
2020
private val SESSION_TIMEOUT: Long = TimeUnit.HOURS.toMillis(1)
2121
private var appKey: String? = null
2222
private var sessionId = UUID.randomUUID()
@@ -117,6 +117,6 @@ class Aptabase private constructor() {
117117

118118
companion object {
119119
@JvmStatic
120-
val shared = Aptabase()
120+
val instance = Aptabase()
121121
}
122122
}

example/src/main/java/com/aptabase/example/MainActivity.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ class MainActivity : AppCompatActivity() {
1212

1313
val initButton: Button = findViewById(R.id.initButton)
1414
initButton.setOnClickListener {
15-
Aptabase.shared.initialize(this, "<api-key>")
15+
Aptabase.instance.initialize(this, "<api-key>")
1616
}
1717

1818
val trackButton: Button = findViewById(R.id.trackButton)
1919
trackButton.setOnClickListener {
20-
Aptabase.shared.trackEvent("connect_click")
20+
Aptabase.instance.trackEvent("connect_click")
2121
}
2222

2323
val trackPropertyButton: Button = findViewById(R.id.trackPropertyButton)
2424
trackPropertyButton.setOnClickListener {
2525
val map = mapOf<String, Any>(
2626
"with_love_from" to "NativeScript"
2727
)
28-
Aptabase.shared.trackEvent("hello", map)
28+
Aptabase.instance.trackEvent("hello", map)
2929
}
3030
}
3131
}

0 commit comments

Comments
 (0)