I am trying to create a directory in /data folder in a Rooted android device using application. I am trying two ways, first by using mkdirs() method, and other by executing the Runtime.exec(). Following is the code :
String path = "/data/abc";
File abc = new File(path);
Process proc = runtime.exec("chmod 777 /data");
proc.waitFor();
proc = runtime.exec("mkdir " + path);
Of course, if I go to 'adb shell' and simply run the command
#mkdir /data/abc
It works. But How do I do it via application. Following is the other way -
String path = "/data/abc";
File abc = new File(path);
boolean isDirCreated = abc.mkdirs();
I am not getting the required folder created in /data folder. I already have the permission in Manifest file of writing external storage.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Kindly suggest any way to do so.