I have an app that runs on a custom android tablet. I want to add a ringtone that I would include in res/raw
folder and the app should copy it to system ringtones folder. I have root access.
I would like it to be over written in case if a ringtone with same name exists.
I tried to google for it but couldn't get any help
UPDATE
I have tried this code but it the file isn't moved/copied
try{
InputStream ins = getResources().openRawResource(
getResources().getIdentifier("ring_default",
"raw", getPackageName()));
Process process = Runtime.getRuntime().exec("su");
DataOutputStream out = new DataOutputStream(process.getOutputStream());
out.writeBytes("mount -o remount,rw /system\n");
out.writeBytes("mv "+ins.toString()+" /system/file.new\n");
out.writeBytes("exit\n");
out.flush();
process.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
Update 2
i tried
out.writeBytes("mv /system/media/audio/ringtones/ring4.wav /system/media/audio/ringtones/ring5.wav\n");
and it works.
Now I need to know how I can find the path to my res/raw folder and replace it in the above case.
Thanks in advance!