欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

Android 后台截屏核心代码,android截屏,RootCommand(

来源: javaer 分享于  点击 25162 次 点评:112

Android 后台截屏核心代码,android截屏,RootCommand(


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;    }
相关栏目:

用户点评