androidMain.io.github.landrynorris.analytiks.firebase.FirebaseAnalyticsLogger.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of analytiks-firebase Show documentation
Show all versions of analytiks-firebase Show documentation
Firebase Analytics integration for Analytiks library
package io.github.landrynorris.analytiks.firebase
import android.os.Bundle
import com.google.firebase.analytics.ktx.analytics
import com.google.firebase.analytics.ktx.logEvent
import com.google.firebase.ktx.Firebase
import io.github.landrynorris.analytiks.AnalytiksLogger
actual class FirebaseAnalyticsLogger: AnalytiksLogger {
private val firebase by lazy {
Firebase.analytics
}
actual override fun logEvent(name: String, extras: Map) {
firebase.logEvent(name) {
extras.entries.forEach {
when(it.value) {
is Double -> param(it.key, it.value as Double)
is Long -> param(it.key, it.value as Long)
is Bundle -> param(it.key, it.value as Bundle)
else -> param(it.key, it.value.toString())
}
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy