I use Google Mobile App Analytics v2 in my application.
I created my own ExceptionParser to have a better description.
@Override
public String getDescription(String threadName, Throwable t) {
StringBuilder messageBuilder = new StringBuilder();
// Header
messageBuilder.append(getHeader());
// Message
messageBuilder.append("Message \n\n");
messageBuilder.append(t.getMessage());
messageBuilder.append("\n\n");
// Stack trace
messageBuilder.append("Stacktrace \n\n");
StackTraceElement[] stackTraceElements = t.getStackTrace();
for (int i = 0; i < stackTraceElements.length; i++) {
StackTraceElement stackTraceElement = stackTraceElements[i];
messageBuilder.append(stackTraceElement.getClassName());
messageBuilder.append(".");
messageBuilder.append(stackTraceElement.getMethodName());
messageBuilder.append("(");
messageBuilder.append(stackTraceElement.getFileName());
messageBuilder.append(":");
messageBuilder.append(stackTraceElement.getLineNumber());
messageBuilder.append(")\n");
}
messageBuilder.append("\n");
// Thread
messageBuilder.append("Thread \n\n");
messageBuilder.append(threadName);
String message = messageBuilder.toString();
try {
MyApplication.getFileLogger().e(message);
} catch (Throwable e) {
// Log.e(TAG,"Exception: " + e.getMessage(),e);
}
return message;
Where I can see this description in analytics console ?
Thank you.
If you do not want to use: https://developers.google.com/analytics/devguides/collection/android/v2/exceptions
According to:
https://developers.google.com/analytics/devguides/collection/android/v2/events
trackEvent(category, action, opt_label, opt_value)
category (required) The name you supply for the group of objects you want to track.
label (optional) An optional string to provide additional dimensions to the event data.
And then:
View the reports. Once event tracking has been set up and working on your site for a day, go to the Content section of the reports and view Event Tracking.
Catgory should be an Exception I guess, and you could provide your information in the label parameter.
I don't know the maximal length alloweb, but should be enough..
EasyTracker.getTracker().trackEvent(
"Crash", // Category
"WatheverYouWant", // Action
getDescription(thread,e), // Label
0); // Value
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.