我是靠谱客的博主 冷傲高跟鞋,这篇文章主要介绍Android内部存储改变读取权限的方法,现在分享给大家,希望可以做个参考。

在开发时,手机先要ROOT,然后在通过代码改变权限。

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<span style="color:#330033;">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; }</span>

引用时需要注意加入权限:

复制代码
1
getRoot("chmod -R 777 /data/data/com.xxxxx/databases/wa.db");

以上这篇Android内部存储改变读取权限的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持靠谱客。

最后

以上就是冷傲高跟鞋最近收集整理的关于Android内部存储改变读取权限的方法的全部内容,更多相关Android内部存储改变读取权限内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(145)

评论列表共有 0 条评论

立即
投稿
返回
顶部