/** * Initialize * * @param context */ public void init(Context context, String crashFilePath) { init(context, crashFilePath, ""); }
private boolean handleException(Throwable ex) { if (ex == null) { return false; } new Thread() { @Override public void run() { Looper.prepare(); Toast.makeText(mContext, showMessage, Toast.LENGTH_SHORT).show(); Looper.loop(); } }.start(); collectDeviceInfo(mContext); String filemameString = saveCrashInfo2File(ex); Logs.d("filemameString", filemameString); return true; }
/** * Caught Exception */ @Override public void uncaughtException(Thread thread, Throwable ex) { if (!handleException(ex) && mDefaultHandler != null) { mDefaultHandler.uncaughtException(thread, ex); } else { try { Thread.sleep(100); } catch (InterruptedException e) { Logs.e("error : ", e); } Logs.d("uncaught exception is catched!"); System.exit(0); android.os.Process.killProcess(android.os.Process.myPid()); } }
/** * Initialize * * @param context */ public void init(Context context) { init(context, "/crash/"); }