コード例 #1
0
 /** 收集调试信息 */
 public static void saveDebug(String message, String exceptiontype, String exlocation) {
   if (PersonDbUtils.isLocked()) {
     try {
       Thread.sleep(PersonConstant.SLEEP_TIMS);
       saveDebug(message, exceptiontype, exlocation);
     } catch (InterruptedException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       return;
     }
     return;
   } else {
     PersonDbUtils.lock();
   }
   SQLiteDatabase db = PersonDbUtils.getInstance().getWritableDatabase();
   // EtongUser user = InstensUserData.getUserData().getEtongUser();
   db.execSQL(PersonConstant.SQL_PERSON_COLLECT);
   ContentValues initialValues = new ContentValues();
   initialValues.put("message", message);
   initialValues.put("exceptiontype", exceptiontype);
   initialValues.put("exlocation", exlocation);
   initialValues.put("phonenum", "13168096632");
   initialValues.put("pruducttime", PersonStringUtils.pareDateToString(new Date()));
   try {
     db.insert("person_collect", null, initialValues);
   } catch (Exception e) {
     PersonDbUtils.unLock();
     e.printStackTrace();
   }
   db.close();
   PersonDbUtils.unLock();
 }
コード例 #2
0
  /** 收集调试信息 */
  public static void uploadCollectDebug() {
    NetworkInfo netWork = PersonStringUtils.getActiveNetwork(null);
    if (netWork.getType() == ConnectivityManager.TYPE_WIFI) {
      System.out.println("开始上传调试信息");
      getAll();
      try {
        for (int i = 0; i < degList.size(); i++) {
          if (degList.get(i).getMessage() == null) {
            degList.get(i).setMessage("");
          }
          if (degList.get(i).getExceptiontype() == null) {
            degList.get(i).setExceptiontype("");
          }
          if (degList.get(i).getExlocation() == null) {
            degList.get(i).setExlocation("");
          }
          if (degList.get(i).getPhonenum() == null) {
            degList.get(i).setPhonenum("");
          }
          if (degList.get(i).getPruducttime() == null) {
            degList.get(i).setPruducttime("");
          }

          try {
            Remot report =
                RemoteFactoryUtils.getFactory().create(Remot.class, PersonConstant.REMOTE_URL);
            boolean ret = false;
            if (ret) {
              delete(degList.get(i).getId());
            }

          } catch (Exception e) {
            CollectDebugLogUtil.saveDebug(
                e.getMessage(), e.getClass().toString(), "\t" + "CollectDebugLogUtil");
            e.printStackTrace();
          }
        }

      } catch (Exception e) {
        CollectDebugLogUtil.saveDebug(
            e.getMessage(), e.getClass().toString(), "\t" + "CollectDebugLogUtil");
        e.printStackTrace();
      }
    }
  }