【发布时间】:2015-08-17 13:19:33
【问题描述】:
我正在尝试构建需要另一个应用程序数据的应用程序。
为此,我首先确保设备具有 root 访问权限,然后获得超级用户访问权限,最后我尝试从日期文件夹中读取一些文件,但 canRead() 函数返回 false。
代码:
if (IsRoot){ //check device root
Process root = Runtime.getRuntime().exec("su");//SuperUser Permission
if(appInstalledOrNot("com.app.name")) {//check application installed
File cacheFile = new File(Environment.getDataDirectory().getAbsolutePath() + "/data/com.name.app/files/", "SOME_FILE"); //Get file
if(cacheFile.exists()){
Toast.makeText(this, "" + cacheFile.canRead(), Toast.LENGTH_SHORT).show(); //Toaste result (false return)
}
}
}
【问题讨论】:
标签: android permissions root superuser