Back to project page twawm2.
The source code is released under:
Copyright (c) 2014, afnf All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistr...
If you think the Android project twawm2 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.appspot.afnf4199ga.utils; //w w w . j av a 2 s .co m import java.lang.Thread.UncaughtExceptionHandler; import android.content.Context; import android.content.pm.PackageInfo; import android.os.Build; public class MyUncaughtExceptionHandler implements UncaughtExceptionHandler { private static final String LABEL = "##MyUncaughtExceptionHandler"; public static void init(Context context) { // ???????????????? UncaughtExceptionHandler h = Thread.getDefaultUncaughtExceptionHandler(); if (h == null || MyStringUtlis.eqauls(LABEL, h.toString()) == false) { // UncaughtExceptionHandler?? Thread.setDefaultUncaughtExceptionHandler(new MyUncaughtExceptionHandler()); // ??????? { Logger.i("device:" + Build.DEVICE); Logger.i("model:" + Build.MODEL); Logger.i("release:" + Build.VERSION.RELEASE); Logger.i("sdk:" + Build.VERSION.SDK_INT); try { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); Logger.i("appver:" + packageInfo.versionName + "(" + packageInfo.versionCode + ")"); } catch (Throwable e) { Logger.w("getPackageInfo failed", e); } } // ???? Logger.startDeleteOldFileThread(); } } @Override public void uncaughtException(Thread thread, Throwable ex) { Logger.e("uncaughtException", ex); Logger.startFlushThread(true); } @Override public String toString() { return LABEL; } }