Click here to Skip to main content
15,896,552 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to modify data in /data/data or /system lets call it file.bin

var sdcardPath = Android.OS.Environment.RootDirectory.Path;
var files = Path.Combine(sdcardPath, "/data/data/com.xyz/file.bin");
Java.Lang.Runtime.GetRuntime().Exec("chmod 777" + files);
BinaryWriter bw = new BinaryWriter(File.OpenWrite(files));


i can read that file, but cant read because System.UnauthorizedAccessException i think it must have permission in manifest like SDCard write permission, but i cant find any documentation to get /Data Write.

What I have tried:

tying with make /data mount to rw but still cannot write
Java.Lang.Runtime.GetRuntime().Exec("su " + "mount -o rw, remount, rw /data ");
Posted
Updated 14-Mar-17 15:24pm

1 solution

Did you look in the Xamarin forums? A quick Google search found this: UnauthorizedAccessException Creating Directory — Xamarin Forums[^]
 
Share this answer
 
Comments
Member 12230809 14-Mar-17 21:35pm    
i want to get grant access to write file in /data/data or /system not in external/internal storage
Graeme_Grant 14-Mar-17 22:41pm    
It may be related though. The key thing is that Xamarin has dedicated specialized forums for your question and you will have a better chance of getting the answer that you are looking for these than here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900