Android 后臺截屏核心代碼
RootCommand("su -c 'screencap /mnt/sdcard/screenaaa.png' && adb pull /sdcard/screenaaa.png") ; /** * 應用程序運行命令獲取 Root權限,設備必須已破解(獲得ROOT權限) * * @param command * 命令:String apkRoot="chmod 777 "+getPackageCodePath(); * RootCommand(apkRoot); * @return 應用程序是/否獲取Root權限 */ private boolean RootCommand(String command) { Process process = null; DataOutputStream os = null; try { process = Runtime.getRuntime().exec("su"); os = new DataOutputStream(process.getOutputStream()); os.writeBytes(command + "\n"); os.writeBytes("exit\n"); os.flush(); process.waitFor(); } catch (Exception e) { Log.d("*** DEBUG ***", "ROOT REE" + e.getMessage()); return false; } finally { try { if (os != null) { os.close(); } process.destroy(); } catch (Exception e) { } } Log.d("*** DEBUG ***", "Root SUC "); return true; }
本文由用戶 cd62 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!