最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Android内部存储改变读取权限的方法
时间:2022-06-25 22:50:23 编辑:袖梨 来源:一聚教程网
在开发时,手机先要ROOT,然后在通过代码改变权限。
public synchronized static boolean getRoot(String paramString)
{
Process process = null;
DataOutputStream os = null;
try
{
process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes(paramString + "n");
os.writeBytes("exitn");
os.flush();
process.waitFor();
} catch (Exception localException)
{
System.out.println("@@@@root cmd error:"+localException);
//localException.printStackTrace();
return false;
}finally {
try {
if (os != null) {
os.close();
}
process.destroy();
} catch (Exception e) {
System.out.println("###root cmd error:"+e);
}
}
return true;
}
引用时需要注意加入权限:
getRoot("chmod -R 777 /data/data/com.xxxxx/databases/wa.db");
相关文章
- Zlibrary中文入口-zlibrary官方中文站 03-04
- 哔咔漫画-免费高清二次元漫画-热门神作尽在PicACG 03-04
- 妖精漫画无删减免费观看:高清原画无遮挡的追漫神器推荐 03-04
- 歪歪漫画免费完整版下载入口-现在还能打开的最新版本地址 03-04
- picacg哔咔网页版入口-嗶咔picacg在线高清观看 03-03
- twitter网页版-twitter官网入口 03-03