我试图使用超级用户修改另一个应用程序的SharedPreferences。
我是这样做的:
Process suProcess = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(suProcess.getOutputStream());
os.writeBytes("echo \"<?xml version='1.0' encoding='utf-8' standalone='yes' ?><map><string name='commentAuthorName'>toto</string></map>\" > /data/data/com.adobe.reader/shared_prefs/com.adobe.reader.preferences.xml' \n");
os.writeBytes("exit\n");
os.flush();
os.close();
suProcess.waitFor();
但是我的申请会冻结。
我做错了什么?
此外,是否有更好的方法来修改我不拥有的另一个应用程序的SharedPreferences?
提前致谢。
朱
答案 0 :(得分:1)
尝试删除preferences.xml之后的行尾的单引号。
答案 1 :(得分:0)
好的,我现在知道为什么我的应用程序冻结了(只是为了精确,它冻结了:进程suProcess = Runtime.getRuntime()。exec(“su”);)。
我正在开发的应用程序是AIR for Android的原生扩展。我正在从Flash构建器启动我的应用程序,显然,这会导致冻结......
从设备正常启动应用程序时,一切正常。