The method setLocalDispatchPeriod(int) from the type GAServiceManager is deprecated

那年仲夏 提交于 2019-12-10 01:48:20

问题


I have latest Google analytics SDK for android and seems like setLocalDispatchPeriod(int) has been deprecated. What is the fix for this ?

There is no where in the internet I could find alternate method for this. And most funniest thing is, google has used this method in their own tutorial of how to get started.

Now does does anybody knows any alternate method ?


回答1:


The reason for the deprecation is outlined in the ServiceManager JavaDoc:

This only works if local dispatching is in use. Local dispatching is only used in the absence of Google Play Services on the device or if manually forced (see setForceLocalDispatch()). In general, applications can not rely on the ability to set the dispatch period. This method should therefore be used with some discretion.

If you are using EasyTracker, you can also specify ga_dispatchPeriod in your analytics.xml file, which should not throw a lint warning about deprecation.

<resources>
  <string name="ga_trackingId">UA-XXXXXXXX-X</string>

  <integer name="ga_dispatchPeriod">30</integer>

  <!-- [...] -->
</resources>

See the Dispatching page of the docs.



来源:https://stackoverflow.com/questions/19938884/the-method-setlocaldispatchperiodint-from-the-type-gaservicemanager-is-depreca

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!