예제 #1
0
  @Override
  public void uncaughtException(Thread arg0, Throwable arg1) {
    // 把错误的堆栈信息 获取出来
    String errorInfo = getErrorInfo(arg1);
    String uuidKey = UUID.nameUUIDFromBytes(errorInfo.getBytes()).toString();

    String existsException = Utils.getSharedPreferences("uncaughtException").getString(uuidKey, "");
    if (!existsException.equals("")) {
      // -- this uncaughtException has got
      Debug.Log("Exception has got yet: " + errorInfo);
      Debug.Log("kill self() ");
      android.os.Process.killProcess(android.os.Process.myPid());
      return;
    }

    Editor editor = Utils.getSharedPreferences("uncaughtException").edit();
    editor.putString(uuidKey, "Mark");
    editor.commit();

    String content = DeviceInfo.getInfo(context).toString();
    String msg = content + "\nStack:\n" + errorInfo;

    Debug.Log("uncaughtException: " + msg);

    errorContent = msg;

    //        sendExceptionMsg();
  }