Initializing appmetrica library with the extended configuration
To initialize the AppMetrica library with extended configuration in Kotlin, follow these steps:
- Import the necessary classes:
import com.yandex.metrica.YandexMetrica
import com.yandex.metrica.YandexMetricaConfig
- Create a YandexMetricaConfig instance with the extended configuration:
val config = YandexMetricaConfig.newConfigBuilder("YOUR_API_KEY")
.withLogs()
.withLocationTracking()
.build()
- Initialize the AppMetrica library with the created configuration:
YandexMetrica.activate(applicationContext, config)
YandexMetrica.enableActivityAutoTracking(application)
- Ensure that the "YOUR_API_KEY" is replaced with the actual API key obtained from the Yandex Metrica website.