华域联盟 Andriod Android内部存储改变读取权限的方法

Android内部存储改变读取权限的方法

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

<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("exit\n");
	      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>

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

getRoot("chmod -R 777 /data/data/com.xxxxx/databases/wa.db");

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

本文由 华域联盟 原创撰写:华域联盟 » Android内部存储改变读取权限的方法

转载请保留出处和原文链接:https://www.cnhackhy.com/107116.htm

本文来自网络,不代表华域联盟立场,转载请注明出处。

作者: sterben

Android 7.0系统webview 显示https页面空白处理方法

发表回复

联系我们

联系我们

2551209778

在线咨询: QQ交谈

邮箱: [email protected]

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们