com.google.android.gms.analytics.ExceptionReporter Java Examples
The following examples show how to use
com.google.android.gms.analytics.ExceptionReporter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Analytics.java From matrix-android-console with Apache License 2.0 | 6 votes |
/** * 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. * @param context App context * @param trackerId The tracker ID to use. * @return A GoogleAnalytics reference */ 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.enableAdvertisingIdCollection(true); mTracker.enableAutoActivityTracking(true); // overwrite the exception parser to be more useful. Thread.UncaughtExceptionHandler handler = Thread.getDefaultUncaughtExceptionHandler(); if (handler != null && handler instanceof ExceptionReporter) { // this handler is the GA one 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; }
Example #2
Source File: FiveCallsApplication.java From android with MIT License | 5 votes |
public void enableAnalyticsHandler() { if (mDefaultHandler == null) { mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler(); } Thread.UncaughtExceptionHandler analyticsHandler = new ExceptionReporter( getDefaultTracker(), Thread.getDefaultUncaughtExceptionHandler(), getApplicationContext()); // Make myHandler the new default uncaught exception handler. Thread.setDefaultUncaughtExceptionHandler(analyticsHandler); }
Example #3
Source File: MainApplication.java From android_gisapp with GNU General Public License v3.0 | 5 votes |
private void setExceptionHandler() { ExceptionReporter handler = new ExceptionReporter(getTracker(), Thread.getDefaultUncaughtExceptionHandler(), this); StandardExceptionParser exceptionParser = new StandardExceptionParser(getApplicationContext(), null) { @Override public String getDescription(String threadName, Throwable t) { return "{" + threadName + "} " + Log.getStackTraceString(t); } }; handler.setExceptionParser(exceptionParser); Thread.setDefaultUncaughtExceptionHandler(handler); }