首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

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

2012-02-22 
App能否得到/data下的文件删除权限Hi all,我的程序要删除/data下的某个文件,但是提示permission denied是

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之类的方法可以获取私有目录。
[解决办法]
所以得进系统把权限改了啊。我一早就说过了,

热点排行