如何删除根应用程序/应用程序/文件? [英] How to delete root app/app/ files?
问题描述
我的手机是植根。我试图做一个非常简单的程序。程序应该删除应用程序/应用程序文件夹中的文件。我怎样才能做到这一点?我是新手,所以例如code看好。
My phone is rooted. I'm trying to do a very simple program. The program should delete file from app/app folder. How can I do this? I'm newbie, so example code is valued.
推荐答案
如果您的手机扎根,你可以通过苏问题作为根命令
—提供的苏
二进制文件是present并在 PATH
—由于Android是Linux的一个变种。只需通过执行删除命令的Runtime.exec()
,和超级用户应采取及时的权限照顾。
If your phone is rooted, you can issue commands as root through su
—provided that the su
binary is present and in your PATH
—since Android is a variant of Linux. Simply execute the delete commands through Runtime.exec()
, and Superuser should take care of the permission prompt.
下面是其用法的一个简单的例子,我花了从这个问题一>:
Here's a simple example of its usage I took from this question:
process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes(command + "\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
这篇关于如何删除根应用程序/应用程序/文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!