@Override public void shutDown(boolean is) { // TODO Auto-generated method stub log("TeamView进程结束"); mTeamViewData.pidId = 0; // handler.removeCallbacksAndMessages(null); // handler.sendEmptyMessageDelayed(UPDATE_STARTEAM,5*60*1000); }
public int getProcessPid() { ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); List<RunningAppProcessInfo> procList = null; int result = -1; procList = activityManager.getRunningAppProcesses(); for (Iterator<RunningAppProcessInfo> iterator = procList.iterator(); iterator.hasNext(); ) { RunningAppProcessInfo procInfo = iterator.next(); // log("processName=" + procInfo.processName); if (procInfo.processName.equals("com.teamviewer.quicksupport.market")) { mTeamViewData.pidId = procInfo.pid; log("get pid success=" + mTeamViewData.pidId); processWatcher = new ProcessWatcher(mTeamViewData.pidId, shutDownListener); processWatcher.start(); break; } } return result; }
public void startTeamView() { log("startTeamView"); Intent mIntent = new Intent(); mIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); ComponentName comp = new ComponentName(paName, MAIN_ACTIVITY); mIntent.setComponent(comp); mIntent.setAction("android.intent.action.VIEW"); startActivity(mIntent); state = STATE_BEGIN; mTeamViewData.pidId = 0; handler.removeMessages(UPDATE_BEGIN_ZHUANGTAI); handler.sendEmptyMessageDelayed(UPDATE_BEGIN_ZHUANGTAI, UPDATE_BEGIN_TIME_TIME); // 先删除上一次的启动tv handler.removeMessages(UPDATE_STARTEAM); // 自动打开 handler.removeMessages(OPEN); handler.sendEmptyMessageDelayed(OPEN, RESTART); }