Copy folders in /data/data to sdcard & vice-versa

有些话、适合烂在心里 提交于 2019-11-29 07:46:01

At the end I got it!!!!

I use the SuperUser process with the cp command to copy the files and folders.

I hope you find it helpful.

String comando = "cp -r /data/data/sourcefolder /sdcard/targetfolder";
Process suProcess = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(suProcess.getOutputStream());
os.writeBytes(comando + "\n");
os.flush();
os.writeBytes("exit\n");
os.flush();
try
{
 int suProcessRetval = suProcess.waitFor();
 if (255 != suProcessRetval)
 {
  // Acceso Root concedido
  retval = true;
 }else
 {
  // Acceso Root denegado
  retval = false;
 }
}
catch (Exception ex)
{
 Log.w("Error ejecutando el comando Root", ex);
}

Thank you very much to all the people of this forum and for all the help which you offer!!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!