Write file with root access in Android Java?

Viewed 20

Is it possible to write to places like /, /system/, etc. Just paths you wouldn't normally be able to without root.

I have Root Access on my device, so rooting is no problem.

How would I be able to make this script ask for su permissions and write to any locations with no problems like access denied?

            URL website = new URL("http://myurl.com/index.html");
            ReadableByteChannel rbc = Channels.newChannel(website.openStream());
            FileOutputStream fos = new FileOutputStream(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM));
            fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
0 Answers
Related