private void startRemoteLogging() {
   remoteLoggingThread =
       new Thread(
           new Runnable() {
             @Override
             public void run() {
               while (!Thread.interrupted()) {
                 try {
                   Thread.sleep(POLL_DELAY_MS);
                 } catch (InterruptedException e) {
                   break;
                 }
                 // checking the last update time
                 String lastTimeStamp = "0";
                 HttpClient httpClient = new DefaultHttpClient();
                 HttpGet request = new HttpGet();
                 try {
                   // set up session header, don't use rest api call whose callback is run on main
                   // thread, will not be called properly
                   request.setHeader("Authorization", "HL " + prefs.getSession());
                   request.setURI(new URI(BuildConfig.ENDPOINT_URL + "/stat/lastUpdate"));
                   HttpResponse response = httpClient.execute(request);
                   BufferedReader in =
                       new BufferedReader(
                           new InputStreamReader(response.getEntity().getContent()));
                   lastTimeStamp = in.readLine();
                   Intent broadcast = new Intent();
                   broadcast.setAction(getString(R.string.remote_logging));
                   broadcast.putExtra("lastTimestamp", lastTimeStamp);
                   // need last update timestamp
                   localBroadcastManager.sendBroadcast(broadcast);
                 } catch (URISyntaxException e) {
                   e.printStackTrace();
                 } catch (ClientProtocolException e) {
                   e.printStackTrace();
                 } catch (IOException e) {
                   e.printStackTrace();
                 }
               }
             }
           });
   remoteLoggingThread.start();
 }
  private void startTimeCount() {

    timedRunnable = new TimedRunnable();
    timeCountThread = new Thread(timedRunnable);
    timeCountThread.start();
  }