Q:

Analytics dispatch doesn't trigger android

The google analytics in my android app does not trigger  dispatch and if I use GoogleAnalytics.getInstance(this.getBaseContext()).dispatchLocalHits(); the following logical is output:
V/GAV4﹕ Thread[main,5,main]: Dispatch call queued. Dispatch will run once initialization is complete.
But no dispatch triggers and nothing shows up in the analytics dashboard. The logcat does not even call it without doing this manually...
I am using this code in my onCreate method in each activity I want to use analytics in in order to set up :
((MyApplication) getApplication()).getTracker(MyApplication.TrackerName.APP_TRACKER); and this code in the onStart method: GoogleAnalytics.getInstance(getApplication()).reportActivityStart(this); and this in the onStop method: GoogleAnalytics.getInstance(getApplication()).reportActivityStop(this);.
This is the analytics code in my application class:
synchronized Tracker getTracker(TrackerName trackerId) {
    Log.d("analytics", "getTracker()");
    Log.d("analytics", String.valueOf(analIsOptedOut));
    Log.d("analytics", "not opt out");
    if (!mTrackers.containsKey(trackerId)) {
        GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
        // Global GA Settings
        // <!-- Google Analytics SDK V4 BUG20141213 Using a GA global xml freezes the app! Do config by coding. -->
        analytics.setDryRun(dryRun);
        analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
        analytics.setLocalDispatchPeriod(15);
        analytics.enableAutoActivityReports(this);
        // Create a new tracker
        Tracker t = analytics.newTracker(R.xml.app_tracker);
        t.enableAdvertisingIdCollection(true);

        mTrackers.put(trackerId, t);
    }
    return mTrackers.get(trackerId);
}

public enum TrackerName {
    APP_TRACKER // Tracker used only in this app.
}

This is my app_tracker.xml:
<?xml version="1.0" encoding="utf-8"?>

<!-- The apps Analytics Tracking Id -->
<string name="ga_trackingId">U.....</string>

<!-- Percentage of events to include in reports -->
<string name="ga_sampleFrequency">30.0</string>

<!-- Enable automatic Activity measurement -->
<bool name="ga_autoActivityTracking">true</bool>

<!-- catch and report uncaught exceptions from the app -->
<bool name="ga_reportUncaughtExceptions">true</bool>

<!-- How long a session exists before giving up -->
<integer name="ga_sessionTimeout">300</integer>

<!-- If ga_autoActivityTracking is enabled, an alternate screen name can be specified to
substitute for the full length canonical Activity name in screen view hit. In order to
specify an alternate screen name use an <screenName> element, with the name attribute
specifying the canonical name, and the value the alias to use instead. -->
<screenName name="com.blah.MainActivity">Main Activity</screenName>

Thanks! :D

A:

On Google Play devices (most Android phones/tables) the Analytics data will be send over to the Play Service for dispatching and GoogleAnalytics.dispatchLocalHits() is noop. The log message you see is misleading but it will not prevent your app from sending the data to the Google Play Service for dispatching.
GoogleAnalytics.reportActivityStart(activity) & reportActivityStop(activity) call is only needed on devices before API level 14 (ICE_CREAM_SANDWICH). On API level 14 devices and later the call is ignored. Android added activity lifecycle callbacks in API level 14. Before 14 you need to manually call GoogleAnalytics.reportActivityStart/reportActivityStop to let Analytics know that activity has started/stopped. On API 14+ Analytics uses the activity lifecycle callback to subscribe to the activity changes and doesn't need the explicit call.
See the documentation on enableAutoActivityReports for more details.
I suspect you don't see any data in your analytics dashboard because of the 30% sampling rate that you set in your tracker xml configuration - <string name="ga_sampleFrequency">30.0</string>. Sampling is performed on device level. Setting sampling to 30% means that your particular device has 70% probability of being sampled out (no hit will be send when the device is sampled out). Try setting the sampling rate to 100% or remove the line all together, the default is no sampling.
The other potential culprit is analytics.setDryRun(dryRun);. Your code doesn't show how dryRun value is defined. If you set dryRun to true no data will be sent to Analytics.

