hu.ponte.respresso.plugin.gradle.GoogleAnalyticsHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of client-android Show documentation
Show all versions of client-android Show documentation
Sync client for Android projects
package hu.ponte.respresso.plugin.gradle;
import com.brsanthu.googleanalytics.GoogleAnalytics;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class GoogleAnalyticsHandler {
public static String appVersion = "0.0.2";
public static GoogleAnalytics ga = GoogleAnalytics.builder()
.withTrackingId("UA-129036545-2")
.withAppName("Android Respresso client")
.withAppVersion(appVersion)
.build();
public static void sendError(Throwable e, Boolean isExceptionFatal) {
StringBuilder error = new StringBuilder();
for (StackTraceElement err : e.getStackTrace())
error.append(err.getClassName())
.append(".")
.append(err.getMethodName())
.append(".")
.append(err.getFileName())
.append(":")
.append(err.getLineNumber())
.append("\n");
sendError(error.toString(), isExceptionFatal);
}
public static void sendError(String error, Boolean isExceptionFatal) {
String host = "Unknown Android host";
try {
host = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
e.printStackTrace();
}
ga.exception().clientId(host).applicationId(appVersion).exceptionFatal(isExceptionFatal)
.exceptionDescription(error)
.send();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy