📅  最后修改于: 2022-03-11 14:53:33.552000             🧑  作者: Mango
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);
}
}