专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Android

App能否得到/data下的文件删除权限,该如何处理

发布时间:2010-05-30 10:52:39 文章来源:www.iduyao.cn 采编人员:星星草
App能否得到/data下的文件删除权限
Hi all,

我的程序要删除/data下的某个文件,但是提示permission denied
是否有办法让我的app得到/data下的删除权限?

Thanks in advance

------解决方案--------------------
adb shell 进入android系统,修改权限 .............烂招.

------解决方案--------------------
我也来支烂招...
Java code

        String command = "rm /data/***";  // the command that will be execute    
        Runtime runtime = Runtime.getRuntime();      
        Process proc = null;
            
        try {
            proc = runtime.exec(command);
        } catch (IOException e1) {
            e1.printStackTrace();
        }
        
        // put a BufferedReader on the ps output     
        InputStream inputstream = proc.getInputStream();
        InputStreamReader inputstreamreader = new InputStreamReader(inputstream);    
        BufferedReader bufferedreader = new BufferedReader(inputstreamreader);    
        
        // read the ps output and show it to screen.
        ...
        ...

        // judge the return value         
        try {    
            if (proc.waitFor() != 0) {    
                System.err.println("exit value = " + proc.exitValue());    
            }     
        }    
        catch (InterruptedException e) {
            System.err.println(e);
        }

------解决方案--------------------
rm的话只用第一个try和最后一个try里面的就可以了,中间的可以不要
------解决方案--------------------
data目录除非你是root或者system用户组,要不是无法执行的。

即使你加上了 WRITE_INTERNAL_MEMORY也是不可以的。

最重要的是你是用sdk来开发三方软件,似乎无解。
------解决方案--------------------
删不了,除非adb shell
------解决方案--------------------
基本的linux知识,应用程序只是普通用户,没有那么高的权限,不可能的事情不要想了。
app可以在自己的目录里作事情,context有getfile之类的方法可以获取私有目录。
------解决方案--------------------
所以得进系统把权限改了啊。我一早就说过了,
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: