有没有方法在不root手机的情况下读取Data目录下的文件
16lz
2021-01-22
有没有方法在不root手机的情况下读取Data目录下的文件
网上有代码是这样的:public void execMethod(){
String line ="";
String args[] = new String[3];
args[0] = "chmod";
args[1] = "777";
args[2] ="/data/data/com.eoemobile/databases/webviewCache.db";
try
{
Process process = Runtime.getRuntime().exec(args);
//get the err line
InputStream stderr = process.getErrorStream();
InputStreamReader isrerr = new InputStreamReader(stderr);
BufferedReader brerr = new BufferedReader(isrerr);
//get the output line
InputStream outs = process.getInputStream();
InputStreamReader isrout = new InputStreamReader(outs);
BufferedReader brout = new BufferedReader(isrout);
String errline = null;
String result = "";
// get the whole error message string while ( (line = brerr.readLine()) != null)
{
result += line;
result += "\n";
}
if( result != "" )
{
// put the result string on the screen
}
// get the whole standard output string
while ( (line = brout.readLine()) != null)
{
result += line;
result += "\n";
}
if( result != "" )
{
System.out.println(result);
}
}catch(Throwable t)
{
t.printStackTrace();
}
}
但是这个代码我没有运行成功,也看不明白,求指教?
更多相关文章
- android OSChina 客户端源代码剖析
- Android 中文件类型与MIME的匹配表
- Android:无法在同一部手机上执行通过Linux部署编译的文件
- 多个dex文件定义了Landroid/支持/v13/app/FragmentCompatICS。
- android代码混淆 GSON完满解决
- Android开源代码解读の地图照片应用Panoramio的实现详解(六)
- 在app引擎端点的启动时执行代码
- 解决:AndroidStudio 下使用AIDL不能生成对应java文件
- 尽管在清单文件中指定了权限,但是ACCESS_FINE_LOCATION SecurityE