i am using xamarin and i want to save txt file there so i have some script that is saving
private void SavetoSd()
{
var sdCardPath = Android.OS.Environment.ExternalStorageDirectory.Path;
var filePath = System.IO.Path.Combine(sdCardPath, "iootext.txt");
if (!System.IO.File.Exists(filePath))
{
using(System.IO.StreamWriter write = new System.IO.StreamWriter(filePath,true))
{
write.Write(etSipServer.ToString());
}
}
}
but the error is that
System.UnauthorizedAccessException: Access to the path "/mnt/sdcard/iootext.txt" is denied.
any help??
in manifest i have added this
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />