2014-01-08 25 views
0

我試圖從我的Android應用程序執行shell腳本以獲取當前屏幕視圖。 我有下面的代碼只能在根目錄的設備上正常工作。爲當前屏幕運行shell命令(「su」)查看

Process sh = null; 
    try 
    { 
     Thread thread=new Thread(new Threadcalling()); 
     thread.start(); 

     sh = Runtime.getRuntime().exec("su"); 
     OutputStream os = sh.getOutputStream(); 
     os.write(("/system/bin/screencap -p " + "/sdcard/img.png").getBytes("ASCII")); 
     os.flush(); 
     os.close(); 
     sh.waitFor(); 
    } 
    catch (Exception e){} 

我應該做些什麼修改才能在無根設備上獲取屏幕視圖。

任何幫助將不勝感激。謝謝。

+0

你不能這樣做,在無根的設備。如果你能夠寫出邪惡的間諜軟件。 – zapl

回答