本文整理汇总了Java中com.google.android.gms.analytics.StandardExceptionParser类的典型用法代码示例。如果您正苦于以下问题:Java StandardExceptionParser类的具体用法?Java StandardExceptionParser怎么用?Java StandardExceptionParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StandardExceptionParser类属于com.google.android.gms.analytics包,在下文中一共展示了StandardExceptionParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: trackException
import com.google.android.gms.analytics.StandardExceptionParser; //导入依赖的package包/类
public void trackException(Exception e) {
if (e != null) {
Tracker t = getGoogleAnalyticsTracker();
t.send(new HitBuilders.ExceptionBuilder()
.setDescription(
new StandardExceptionParser(this, null)
.getDescription(Thread.currentThread().getName(), e))
.setFatal(false)
.build()
);
}
}
示例2: trackException
import com.google.android.gms.analytics.StandardExceptionParser; //导入依赖的package包/类
/***
* Tracking exception
*
* @param e exception to be tracked
*/
public void trackException(Exception e) {
if (e != null) {
Tracker t = getGoogleAnalyticsTracker();
t.send(new HitBuilders.ExceptionBuilder()
.setDescription(
new StandardExceptionParser(this, null)
.getDescription(Thread.currentThread().getName(), e))
.setFatal(false)
.build()
);
}
}
示例3: trackException
import com.google.android.gms.analytics.StandardExceptionParser; //导入依赖的package包/类
public void trackException(Exception e) {
if (e != null) {
Tracker t = getGoogleAnalyticsTracker();
t.send(new HitBuilders.ExceptionBuilder()
.setDescription(new StandardExceptionParser(this, null).getDescription(Thread.currentThread().getName(), e))
.setFatal(false)
.build()
);
}
}
示例4: exception
import com.google.android.gms.analytics.StandardExceptionParser; //导入依赖的package包/类
@Override
public void exception(Exception e) {
if (e != null) {
tracker.send(new HitBuilders.ExceptionBuilder()
.setDescription(
new StandardExceptionParser(applicationContext, null).getDescription(Thread.currentThread().getName(), e))
.setFatal(false)
.build()
);
}
}
示例5: sendAnalyticsError
import com.google.android.gms.analytics.StandardExceptionParser; //导入依赖的package包/类
public void sendAnalyticsError(Throwable e)
{
String analyticsPath = this.getClass().getName();
Tracker t = ((E621Application) getApplication()).getTracker();
t.send(new HitBuilders.ExceptionBuilder().
setDescription(new StandardExceptionParser(this, null).getDescription(analyticsPath, e)).
setFatal(false).
build()
);
}
示例6: Tracker
import com.google.android.gms.analytics.StandardExceptionParser; //导入依赖的package包/类
@Inject
public Tracker(@ForApplication Context context) {
this.context = context;
analytics = GoogleAnalytics.getInstance(context);
tracker = analytics.newTracker(R.xml.google_analytics);
tracker.setAppVersion(Integer.toString(BuildConfig.VERSION_CODE));
exceptionParser = new StandardExceptionParser(context, null);
if (BuildConfig.DEBUG) {
analytics.setDryRun(true);
}
}
示例7: sendException
import com.google.android.gms.analytics.StandardExceptionParser; //导入依赖的package包/类
@Override
public void sendException(Throwable throwable, boolean isFatal) {
this.tracker.send(new HitBuilders.ExceptionBuilder()
.setDescription(new StandardExceptionParser(this.application, null).getDescription(Thread.currentThread().getName(), throwable))
.setFatal(isFatal)
.build());
}
示例8: trackException
import com.google.android.gms.analytics.StandardExceptionParser; //导入依赖的package包/类
/***
* Tracking exception
* Note: LogHelper will track exceptions as well,
* so no need to call if making use of LogHelper with a throwable.
*
* @param e exception to be tracked
*/
public void trackException(Exception e) {
if (e != null) {
Tracker tracker = getGoogleAnalyticsTracker();
tracker.send(new HitBuilders.ExceptionBuilder()
.setDescription(new StandardExceptionParser(this, null)
.getDescription(Thread.currentThread().getName(), e))
.setFatal(false)
.build()
);
}
}
示例9: getViewObject
import com.google.android.gms.analytics.StandardExceptionParser; //导入依赖的package包/类
public synchronized <T extends ViewObject> T getViewObject(Class<T> clazz) {
if (!data.containsKey(clazz.getName())) {
try {
Constructor<T> constructor = clazz.getConstructor(Context.class);
data.put(clazz.getName(), constructor.newInstance(this));
} catch (Exception e) {
Log.w(TAG, "failed to create empty viewstate", e);
Tracker t = getTracker();
t.send(new HitBuilders.ExceptionBuilder()
.setDescription(new StandardExceptionParser(this, null).getDescription(Thread.currentThread().getName(), e))
.setFatal(false).build());
}
}
return (T) data.get(clazz.getName());
}
示例10: onStartDiag
import com.google.android.gms.analytics.StandardExceptionParser; //导入依赖的package包/类
@Override
public void onStartDiag() {
try {
Message msg = Message.obtain(null, EidService.DIAG, 0, 0);
msg.replyTo = mEidServiceResponse;
mEidService.send(msg);
} catch (Exception e) {
Tracker t = ((EidSuiteApp) this.getApplication()).getTracker();
t.send(new HitBuilders.ExceptionBuilder()
.setDescription(new StandardExceptionParser(this, null).getDescription(Thread.currentThread().getName(), e))
.setFatal(false).build());
Toast.makeText(this, R.string.toastFailed, Toast.LENGTH_LONG).show();
}
}
示例11: navigate
import com.google.android.gms.analytics.StandardExceptionParser; //导入依赖的package包/类
private void navigate() {
try {
String urlValue = url.getText().toString();
URL parsed = new URL(urlValue.contains("://") ? urlValue : "http://" + urlValue);
listener.onGo(parsed.toString());
} catch (MalformedURLException e) {
Toast.makeText(GoDialog.this.getActivity(), R.string.toastInvalidUrl, Toast.LENGTH_LONG).show();
Tracker tracker = ((EidSuiteApp) GoDialog.this.getActivity().getApplication()).getTracker();
tracker.send(new HitBuilders.ExceptionBuilder()
.setDescription(new StandardExceptionParser(GoDialog.this.getActivity(), null).getDescription(Thread.currentThread().getName(), e))
.setFatal(false).build());
}
}
示例12: onCreateDialog
import com.google.android.gms.analytics.StandardExceptionParser; //导入依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(R.string.diagEndMsg)
.setTitle(R.string.diagTitle)
.setNegativeButton(R.string.cancel, null)
.setPositiveButton(R.string.send, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent i = new Intent(Intent.ACTION_SENDTO);
i.setType("text/plain");
i.setData(Uri.parse("mailto:[email protected]"));
i.putExtra(Intent.EXTRA_SUBJECT, "eID Suite: Diagnostics");
i.putExtra(Intent.EXTRA_TEXT, getArguments().getString("Result"));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
startActivity(i);
} catch (ActivityNotFoundException ex) {
Toast.makeText(getActivity(), R.string.toastNoMailClient, Toast.LENGTH_SHORT).show();
Tracker tracker = ((EidSuiteApp) EndDiagDialog.this.getActivity().getApplication()).getTracker();
tracker.send(new HitBuilders.ExceptionBuilder()
.setDescription(new StandardExceptionParser(EndDiagDialog.this.getActivity(), null).getDescription(Thread.currentThread().getName(), ex))
.setFatal(false).build());
}
}
});
return builder.create();
}
示例13: sendException
import com.google.android.gms.analytics.StandardExceptionParser; //导入依赖的package包/类
@Override
public void sendException(Context c, Exception e, boolean fatal, String additionalData) {
try {
Tracker t = getAppTracker();
if (t != null && e != null) {
HitBuilders.ExceptionBuilder eb = new HitBuilders.ExceptionBuilder()
.setFatal(fatal)
.setCustomDimension(GA_DIM_EXCEPTION_NAME,
e.getClass().getCanonicalName())
.setDescription(
new StandardExceptionParser(c, null)
.getDescription(Thread.currentThread()
.getName(), e)
);
if (!TextUtils.isEmpty(additionalData)) {
eb.setCustomDimension(GA_DIM_ADDITIONAL_DATA, additionalData.substring(0, Math.min(additionalData.length(), 4096)));
}
eb.setCustomDimension(GA_DIM_EXCEPTION_MESSAGE, e.getMessage());
t.send(eb.build());
}
} catch (Exception e2) {
Log.e(TAG, "sendException", e2);
}
if (BuildConfig.DEBUG) {
if (e != null) {
Log.d(TAG, String.format("%s (%s)", e.getMessage(), additionalData));
}
}
}
示例14: setExceptionHandler
import com.google.android.gms.analytics.StandardExceptionParser; //导入依赖的package包/类
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);
}
示例15: trackException
import com.google.android.gms.analytics.StandardExceptionParser; //导入依赖的package包/类
@Override
public void trackException(String s, Exception e, boolean fatal) {
final String description = new StandardExceptionParser(ctx, null)
.getDescription(Thread.currentThread().getName(), e);
final Map<String, String> exceptionMap = new HitBuilders.ExceptionBuilder()
.setDescription(s + " " + description)
.setFatal(fatal).build();
tracker.send(exceptionMap);
}