Hello Devs,
I am trying to write data to a system file located in /data/misc/wifi/wpa_suppant.conf using this code.
But i get no output. My phone is rooted so that is not the issue. Any suggestions?
I am trying to write data to a system file located in /data/misc/wifi/wpa_suppant.conf using this code.
Code:
try {
[URL="http://www.google.com/search?hl=en&q=allinurl%3ARuntime+java.sun.com&btnI=I%27m%20Feeling%20Lucky"]Runtime[/URL].getRuntime().exec("su");
[URL="http://www.google.com/search?hl=en&q=allinurl%3AFile+java.sun.com&btnI=I%27m%20Feeling%20Lucky"]File[/URL] root = [URL="http://www.google.com/search?hl=en&q=allinurl%3AEnvironment+java.sun.com&btnI=I%27m%20Feeling%20Lucky"]Environment[/URL].getExternalStorageDirectory;
[URL="http://www.google.com/search?hl=en&q=allinurl%3AFile+java.sun.com&btnI=I%27m%20Feeling%20Lucky"]File[/URL] root = new [URL="http://www.google.com/search?hl=en&q=allinurl%3AFile+java.sun.com&btnI=I%27m%20Feeling%20Lucky"]File[/URL]("/data/misc/wifi/");
if (root.canWrite()){
[URL="http://www.google.com/search?hl=en&q=allinurl%3AFile+java.sun.com&btnI=I%27m%20Feeling%20Lucky"]File[/URL] textFile = new [URL="http://www.google.com/search?hl=en&q=allinurl%3AFile+java.sun.com&btnI=I%27m%20Feeling%20Lucky"]File[/URL](root + "wpa_supplicant.conf");
boolean append = true;
[URL="http://www.google.com/search?hl=en&q=allinurl%3AFileWriter+java.sun.com&btnI=I%27m%20Feeling%20Lucky"]FileWriter[/URL] textWriter = new [URL="http://www.google.com/search?hl=en&q=allinurl%3AFileWriter+java.sun.com&btnI=I%27m%20Feeling%20Lucky"]FileWriter[/URL](textFile, append);
[URL="http://www.google.com/search?hl=en&q=allinurl%3ABufferedWriter+java.sun.com&btnI=I%27m%20Feeling%20Lucky"]BufferedWriter[/URL] out = new [URL="http://www.google.com/search?hl=en&q=allinurl%3ABufferedWriter+java.sun.com&btnI=I%27m%20Feeling%20Lucky"]BufferedWriter[/URL](textWriter);
out.write("network");
out.flush();
out.close();
} catch ([URL="http://www.google.com/search?hl=en&q=allinurl%3AIOException+java.sun.com&btnI=I%27m%20Feeling%20Lucky"]IOException[/URL] e) {
}