I'm using chmod command to change file's permission but it's doesn't work in my code and my device is rooted too:
String MyFilePath = "/data/data/MyPkgName/database/com.pocketchange.android.http.AsyncHttpRequestService.db";
CommandCapture command = new CommandCapture(0, "chmod 777 " + "\""+ MyFilePath+ "\"");
RootTools.getShell(true).add(command).waitForFinish();
And when it's execute, the command output is :
Unable to chmod /data/data/MyPkgName/databases/com.pocketchange.android.http.AsyncHttpRequestService.db: No such file or directory
but the file is exist, and when I use this code to change the permission of another file in the database directory its success, so what can I do now.
Use the chmod command in the ADB shell...
String[] strExec = new String[]
{
"/system/bin/sh", "-c","/system/bin/chmod 777
};
try {
Runtime.getRuntime().exec(strExec);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}