当前位置: 动力学知识库 > 问答 > 编程问答 >

Google Analytics Android v3, difference of GoogleAnalytics and GAServiceManager

问题描述:

I'm wondering why do we need two classes, what functionality we should do with each one?

I'm a bit confused because according to the docs, for example, to set dispatch period, we can do it with both classes:

To set the dispatch period programmatically:

// Set the dispatch period in seconds.

GAServiceManager.getInstance().setLocalDispatchPeriod(15);

Setting a negative value will disable periodic dispatch, requiring that you use manual dispatch if you want to send any data to Google Analytics.

// Disable periodic dispatch by setting dispatch period to a value less than 1.

GoogleAnalytics.getInstance(this).setDispatchPeriod(0);

网友答案:

According to the inheritance:

com.google.analytics.tracking.android.GAServiceManager extends com.google.analytics.tracking.android.ServiceManager
com.google.analytics.tracking.android.GoogleAnalytics extends com.google.analytics.tracking.android.TrackerHandler

And according to GA official docs:

The local dispatch methods referenced in this document have been marked as deprecated due to the forthcoming availability of Google Analytics as part of Google Play Services. Local dispatch methods may still be used in non-Google-experience devices.

So:

GAServiceManager.getInstance().setLocalDispatchPeriod(xyz); // is deprecated
GoogleAnalytics.getInstance(context).setDispatchPeriod(xyz); // should use this in the future, because GA will be integrated into Google Play Services

That's all it tells, sorry that could not find any other documentation or source code telling why.

分享给朋友:
您可能感兴趣的文章:
随机阅读: