| | |
| | | import java.util.List; |
| | | import java.util.Timer; |
| | | import java.util.TimerTask; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.concurrent.Future; |
| | | import java.util.regex.Matcher; |
| | |
| | | getPermission(); |
| | | mXService = new MyService(this); |
| | | //Timber.tag("====>").d(LMobileInfo.getDeviceUniqueId()); |
| | | Thread.setDefaultUncaughtExceptionHandler((thread, throwable) -> { |
| | | String time2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); |
| | | getVM().addInfo("GlobalException线程报错:" + thread.getName()); |
| | | try { |
| | | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | PrintStream print = new PrintStream(out); |
| | | //导出发生异常的时间 |
| | | print.println(time2); |
| | | print.println(); |
| | | throwable.printStackTrace(print); |
| | | SpUtil.saveString(CrashHandler.FILE_NAME+time2,new String(out.toByteArray())); |
| | | print.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | getVM().addInfo("错误日志2"+e.getMessage()); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private void initM(){ |
| | |
| | | if((availableMemory<100&&showTime!=null&&(System.currentTimeMillis()-showTime>5000))|| |
| | | ("02:00:00".equals(StringUtil.getHM()))){ |
| | | //可用内存小于400M,或者每天凌晨2点,重启app |
| | | //ToastView.show(MApplication.mContext,"内存紧张,重新启动"); |
| | | restartApp(); |
| | | } |
| | | } |
| | |
| | | } |
| | | lastDownTime1 = System.currentTimeMillis(); |
| | | downCount1++; |
| | | System.out.println(); |
| | | //Timber.tag("==>").d(""+downCount1); |
| | | if(downCount1>4) { |
| | | downCount1=0; |
| | |
| | | } |
| | | } |
| | | }); |
| | | |
| | | getDB().imgLeft.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v1) { |
| | |
| | | |
| | | @Subscribe |
| | | public void GetFacesEvent(GetFacesEvent event){ |
| | | getVM().addInfo("查询人脸数据======》"); |
| | | if(!isFinishing()&&!isUpdatingFace){ |
| | | getVM().addInfo("查询人脸数据======》isDBLoad = "+isDBLoad); |
| | | if(isDBLoad){ |
| | |
| | | |
| | | @Subscribe(threadMode = ThreadMode.MAIN) |
| | | public void HttpEvent(HttpEvent e){ |
| | | if(!isFinishing()){ |
| | | if(!isFinishing()&&getVM()!=null){ |
| | | getVM().addInfo(e.getMsg()); |
| | | } |
| | | } |