I am using just this in every Activity:
@Override
public void onStart() {
super.onStart();
EasyTracker.getInstance().activityStart(this);
}
@Override
public void onStop() {
super.onStop();
EasyTracker.getInstance().activityStop(this);
}
and going through this doc
I found out:
Using EasyTracker
To automatically track all uncaught exceptions in your app using EasyTracker, add this line to your analytics.xml file:
<bool name="ga_reportUncaughtExceptions">true</bool>
After tracking an exception using automatic exception tracking, EasyTracker will pass the exception on to the Thread's default exception handler.
When using automatic exception tracking, keep in mind the following:
But when i get an UncaughtException and the application crashes, in the Google Analytics description, it just shows:
An error occured while executing doInBackground()
not the Stack Trace as mentioned in the above points. Any thing needs to be added??
Thank You
I use an open source tool called ACRA for uncaught exception reporting. It provides significantly more information than Google Analytics or Flurry do, and submits reports to a Google Doc, to which you can get email notification for every report added.
I use Google Analytics for the rest.
You should use a custom exception parser to get the whole stacktrace
import org.apache.commons.lang3.exception.ExceptionUtils;
import com.google.analytics.tracking.android.ExceptionParser;
public class AnalyticsExceptionParser implements ExceptionParser {
public String getDescription(String p_thread, Throwable p_throwable) {
return "Thread: " + p_thread + ", Exception: " + ExceptionUtils.getStackTrace(p_throwable);
}
}
and set this as default in you activity, like
public void setupGoogleAnalyticsCrashReportParser() {
EasyTracker.getInstance().setContext(this);
Thread.UncaughtExceptionHandler uncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
if (uncaughtExceptionHandler instanceof ExceptionReporter) {
ExceptionReporter exceptionReporter = (ExceptionReporter) uncaughtExceptionHandler;
exceptionReporter.setExceptionParser(new AnalyticsExceptionParser());
}
}
Hope this helps to someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With