@Override public void run() { super.run(); SignApplication.GetDBInfo("Sign"); SignApplication.GetDBInfo("Service"); SignApplication.GetDBInfo("Menu"); SignApplication.GetDBInfo("Patient"); SignApplication.GetDBInfo("Push"); SignApplication.GetDBInfo("Room"); while (true) { hospitalMd5 = false; signMd5 = false; serviceMd5 = false; menuMd5 = false; patientMd5 = false; pushMd5 = false; roomMd5 = false; if (networkStatusOK(MainActivity.context) && SignApplication.userInfoList.get(0).userauto.equals("true")) { Message msg = ConnectHttp.wcHandler.obtainMessage(); msg.what = 5; Bundle myBundle = new Bundle(); myBundle.putString("url", ConnectHttp.postOfficeInfo(false, SystemInfo.accesstoken)); myBundle.putString("key", SystemInfo.accesstoken); msg.obj = myBundle; msg.sendToTarget(); msg = new Message(); myBundle = new Bundle(); msg.what = 7; myBundle.putString("url", ConnectHttp.postSignList(false, SystemInfo.accesstoken)); myBundle.putString("key", SystemInfo.accesstoken); msg.obj = myBundle; ConnectHttp.wcHandler.sendMessage(msg); msg = new Message(); myBundle = new Bundle(); msg.what = 9; myBundle.putString("url", ConnectHttp.postServiceList(false, SystemInfo.accesstoken)); myBundle.putString("key", SystemInfo.accesstoken); msg.obj = myBundle; ConnectHttp.wcHandler.sendMessage(msg); msg = new Message(); myBundle = new Bundle(); msg.what = 11; myBundle.putString("url", ConnectHttp.postMenuList(false, SystemInfo.accesstoken)); myBundle.putString("key", SystemInfo.accesstoken); msg.obj = myBundle; ConnectHttp.wcHandler.sendMessage(msg); msg = new Message(); myBundle = new Bundle(); msg.what = 13; myBundle.putString("url", ConnectHttp.postPatientList(false, SystemInfo.accesstoken)); myBundle.putString("key", SystemInfo.accesstoken); msg.obj = myBundle; ConnectHttp.wcHandler.sendMessage(msg); msg = new Message(); myBundle = new Bundle(); msg.what = 15; myBundle.putString("url", ConnectHttp.postPushList(false, SystemInfo.accesstoken)); myBundle.putString("key", SystemInfo.accesstoken); msg.obj = myBundle; ConnectHttp.wcHandler.sendMessage(msg); msg = new Message(); myBundle = new Bundle(); msg.what = 17; myBundle.putString("url", ConnectHttp.postRoomList(false, SystemInfo.accesstoken)); myBundle.putString("key", SystemInfo.accesstoken); msg.obj = myBundle; ConnectHttp.wcHandler.sendMessage(msg); SignApplication.db.open(); SignApplication.dbuser.put("autoUpdateThread", "true"); if (SignApplication.userInfoList.get(0).auto.equals("true")) { upload(); } SignApplication.dbuser.remove("autoUpdateThread"); SignApplication.db.close(); } else if (!networkStatusOK(MainActivity.context)) { SignApplication.GetDBInfo("Sign"); SignApplication.GetDBInfo("Service"); SignApplication.GetDBInfo("Menu"); SignApplication.GetDBInfo("Patient"); SignApplication.GetDBInfo("Push"); SignApplication.GetDBInfo("Room"); } try { Thread.sleep(1000 * 60 * 60); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }