@Override
 protected Void doInBackground(Void... params) {
   Logger.d("STARTED: SignUpTask");
   toastMessage = null;
   HttpClient client = new DefaultHttpClient();
   HttpPost post = new HttpPost(This.URL);
   post.setHeader("content-type", "application/json");
   try {
     String uuid = prefs.getString(This.KEY_UUID, This.NULL);
     String userLog = new Gson().toJson(new UserLog(uuid, email));
     Logger.d("user log: " + userLog);
     post.setEntity(new StringEntity(userLog));
     HttpResponse response = client.execute(post);
     StatusLine statusLine = response.getStatusLine();
     if (statusLine.getStatusCode() == HttpStatus.SC_OK) {
       toastMessage = successMessage;
       Editor editor = prefs.edit();
       editor.putBoolean(This.KEY_SIGNED_UP, true);
       editor.commit();
     } else {
       throw new Exception(statusLine.getReasonPhrase());
     }
   } catch (UnknownHostException e) {
     toastMessage = noNetMessage;
   } catch (Exception e) {
     toastMessage = "Error: " + e.getMessage();
     e.printStackTrace();
   }
   Logger.d("FINISHED: SignUpTask");
   return null;
 }
  @Override
  public void run() {
    Logger.d("STARTED: OutSmsLogger");
    timeLastChecked = prefs.getLong(This.KEY_TIME_LAST_CHECKED_OUT_SMS, This.DEFAULT_LONG);
    String uuid = prefs.getString(This.KEY_UUID, This.NULL);

    Cursor cursor =
        context
            .getContentResolver()
            .query(SMS_URI, COLUMNS, WHERE + " AND date > " + timeLastChecked, null, ORDER);
    Set<SmsLog> smsLogs = null;
    long date;
    String address, body, simNumber;
    SmsLog outSmsLog;
    if (cursor.moveToNext()) {
      smsLogs = new HashSet<SmsLog>();
      timeLastChecked = cursor.getLong(cursor.getColumnIndex("date"));
      simNumber = tm.getLine1Number();
      do {
        date = cursor.getLong(cursor.getColumnIndex("date"));
        address = cursor.getString(cursor.getColumnIndex("address"));
        body = cursor.getString(cursor.getColumnIndex("body"));
        outSmsLog =
            new SmsLog(uuid, This.TYPE_OUT_SMS, address, simNumber, date, body.length(), roaming);

        if (smsLogs.contains(outSmsLog)) {
          continue;
        }

        smsLogs.add(outSmsLog);
      } while (cursor.moveToNext());
    }

    if (smsLogs == null) {
      Logger.d("no sent SMSes found");
    } else {
      List<SmsLog> smsLogsList = new ArrayList<SmsLog>();
      smsLogsList.addAll(smsLogs);
      DB db = DB.getInstance(context);
      db.addSmsLogs(smsLogsList);
      Logger.d("added: " + new Gson().toJson(smsLogsList));
    }

    cursor.close();
    Editor editor = prefs.edit();
    editor.putLong(This.KEY_TIME_LAST_CHECKED_OUT_SMS, timeLastChecked);
    editor.commit();

    Logger.d("FINISHED: OutSmsLogger");
  }