I know this has been asked a lot but never answered. I definetly need to write files to root there is no other solution. I currently use this code but it doesn\'t show anyth
I kept digging and I have found a way to do it.
After some attempts my ROM (more exactly /system folder) was so heavily damaged that I always had seen the errorstream input : "no permission" -> reinstalled ROM with wipes
I copied files to external storage (in this case /sdcard but be aware that it might be another path - use Environment Object to get the path). I extracted all subfolders to main folders.
New code as the previous ones opened a SU session and closed it again.
Process proc = runtime.exec("su");
new ProcessReader(proc).start();
new ErrorReader(proc).start();
DataOutputStream os = new DataOutputStream(
proc.getOutputStream());
os.writeBytes("chmod 755 /system/" + "\n");
os.writeBytes("find /sdcard/.beats_cache/systembin -exec mv '{}' /system/bin +\n");
os.writeBytes("find /sdcard/.beats_cache/systemlib -exec mv '{}' /system/lib +\n");
os.writeBytes("find /sdcard/.beats_cache/systemetc -exec mv '{}' /system/etc +\n");
os.writeBytes("find /sdcard/.beats_cache/systemetcaudio -exec mv '{}' /system/etc/audio +\n");
os.writeBytes("find /sdcard/.beats_cache/systemetcsoundimage -exec mv '{}' /system/etc/soundimage +\n");
os.writeBytes("find /sdcard/.beats_cache/systemlibsoundfx -exec mv '{}' /system/lib/soundfx +\n");
os.writeBytes("exit\n");
os.flush();