Important: This document describes a legacy version of the SDK. New users should use the latest SDK.

Dispatching - Android SDK

This document describes how you can manage dispatching data to Google Analytics using the Google Analytics SDK for Android v3.

Overview

Data collected using the Google Analytics SDK for Android is stored locally before being dispatched on a separate thread to Google Analytics.

Data must be dispatched and received by 4 a.m. of the following day, in the local time zone of each view. Any data received later than that will not appear in reports. For example, if a hit is queued locally at 11:59pm, it must be dispatched within 4 hours, by 3:59am, to appear in reports. On the other hand, a hit queued at 12:00am must be dispatched within 28 hours, i.e., 3:59am of the following day, in order to appear in reports.

Periodic dispatching

By default, data is dispatched from the Google Analytics SDK for Android every 30 minutes.

To set the dispatch period programmatically:

// Set the dispatch period in seconds.
GAServiceManager.getInstance().setLocalDispatchPeriod(15);

To set the dispatch period in XML using EasyTracker:

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

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);

If a user loses network access or quits your app while there are still hits waiting to be dispatched, those hits are persisted in local storage. They will be dispatched the next time your app is running and dispatch is called.

Manual dispatching

To manually dispatch hits, for example when you know the device radio is already being used to send other data:

GAServiceManager.getInstance().dispatchLocalHits();