public static GoogleAnalytics initialiseGoogleAnalytics(Context context,String trackerId,final ExceptionParser callback){
  mAnalytics=GoogleAnalytics.getInstance(context);
  mAnalytics.setLocalDispatchPeriod(1800);
  mTracker=mAnalytics.newTracker(trackerId);
  mTracker.enableExceptionReporting(true);
  mTracker.enableAutoActivityTracking(true);
  Thread.UncaughtExceptionHandler handler=Thread.getDefaultUncaughtExceptionHandler();
  if (handler != null && handler instanceof ExceptionReporter) {
    ExceptionReporter exceptionReporter=(ExceptionReporter)handler;
    exceptionReporter.setExceptionParser(callback);
    Thread.setDefaultUncaughtExceptionHandler(exceptionReporter);
    Log.d(LOG_TAG,"Analytics active.");
  }
 else {
    Log.e(LOG_TAG,"Cannot set custom exception parser.");
  }
  return mAnalytics;
}

public static GoogleAnalytics initialiseGoogleAnalytics ( Context context , String trackerId , final ExceptionParser callback ) { mAnalytics = GoogleAnalytics . getInstance ( context ) ; mAnalytics . setLocalDispatchPeriod ( 1800 ) ; mTracker = mAnalytics . newTracker ( trackerId ) ; mTracker . enableExceptionReporting ( true ) ; mTracker . enableAutoActivityTracking ( true ) ; Thread . UncaughtExceptionHandler handler = Thread . getDefaultUncaughtExceptionHandler ( ) ; if ( handler != null && handler instanceof ExceptionReporter ) { ExceptionReporter exceptionReporter = ( ExceptionReporter ) handler ; exceptionReporter . setExceptionParser ( callback ) ; Thread . setDefaultUncaughtExceptionHandler ( exceptionReporter ) ; Log . d ( LOG_TAG , "Analytics active." ) ; } else { Log . e ( LOG_TAG , "Cannot set custom exception parser." ) ; } return mAnalytics ; }
initialise google analytics immediately so it will catch all sorts of errors prior to easytracker onstart . also makes sensible exception stack traces if you want .
