Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 ?

like image 993
Muhammad Riyaz Avatar asked Nov 12 '13 20:11

Muhammad Riyaz


1 Answers

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.

like image 148
Bryan Herbst Avatar answered Oct 03 '22 02:10

Bryan Herbst