Skip to content

Commit ff81e16

Browse files
committed
Countly
1 parent d68a4df commit ff81e16

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

LogcatCountlyLib/src/main/java/info/hannes/countly/Analytics.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,11 @@ class Analytics : IAnalytics {
5858
}
5959

6060
companion object {
61-
private const val COUNTLY_HOST = "https://countly.apinext.bmw.com"
6261

6362
val segmentation = HashMap<String, String>()
6463

6564
@SuppressLint("HardwareIds")
66-
fun initAnalytics(context: Context, loggingEnabled: Boolean = false, countlyKey: String) {
65+
fun initAnalytics(context: Context, loggingEnabled: Boolean = false, countlyKey: String, countlyHost: String) {
6766
var version = ""
6867
try {
6968
val pInfo = context.packageManager.getPackageInfo(context.packageName, 0)
@@ -78,7 +77,7 @@ class Analytics : IAnalytics {
7877
.setContext(context)
7978
.setDeviceId(Settings.Secure.getString(context.contentResolver, Settings.Secure.ANDROID_ID))
8079
.setIdMode(DeviceId.Type.DEVELOPER_SUPPLIED)
81-
.setServerURL(COUNTLY_HOST)
80+
.setServerURL(countlyHost)
8281
.setLoggingEnabled(loggingEnabled)
8382
.setViewTracking(true)
8483
.setHttpPostForced(true)

LogcatCountlyLib/src/main/java/info/hannes/logging/LoggingApplication.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import info.hannes.timber.DebugTree
77
import timber.log.Timber
88

99
abstract class LoggingApplication(
10+
private val countlyHost: String,
1011
private val countlyKey: String,
1112
private val debugBuildType: Boolean,
1213
private val serverIgnoreToken: String? = null
@@ -29,7 +30,7 @@ abstract class LoggingApplication(
2930
protected fun setupLogging(countlyLogging: Boolean) {
3031
Timber.plant(DebugTree())
3132
if (countlyLogging) {
32-
Analytics.initAnalytics(this, countlyLogging, countlyKey)
33+
Analytics.initAnalytics(this, countlyLogging, countlyKey, countlyHost)
3334
Timber.plant(CountlyTree(Analytics(), serverIgnoreToken))
3435
}
3536
}

sample/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ android {
3939
dependencies {
4040
implementation project(':LogcatCoreLib')
4141
implementation project(':LogcatCrashlyticLib')
42+
implementation project(':LogcatCountlyLib')
4243
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
4344
implementation "androidx.appcompat:appcompat:1.1.0"
4445
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

0 commit comments

Comments
 (0)