Initializing appmetrica library with the extended configuration

To initialize the AppMetrica library with extended configuration in Kotlin, follow these steps:

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