📜  使用扩展配置初始化 appmetrica 库 - Kotlin 代码示例

📅  最后修改于: 2022-03-11 14:53:33.552000             🧑  作者: Mango

代码示例1
public class MyApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        // Creating an extended library configuration.
        YandexMetricaConfig config = YandexMetricaConfig.newConfigBuilder(API_key)
                // Setting up the configuration. For example, to enable logging.
                .withLogs()
                ...
                .build();
        // Initializing the AppMetrica SDK.
        YandexMetrica.activate(getApplicationContext(), config);
        // Automatic tracking of user activity.
        YandexMetrica.enableActivityAutoTracking(this);
    }
}