Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Creating a file Error

NoshNosh GBMember ✭✭

I am trying to create a text file in the "/mnt/sdcard" folder but i am getting an error

"/mnt/sdcard/ServURL.txt (Permission denied)" and

Permissions in the Manifest are:

<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.BATTERY_STATS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.USE_SIP" />
<uses-permission android:name="android.permission.INTERNET" />

Snippet of code below.

Java.IO.File Files = new Java.IO.File(AppFolder + "/ServURL.txt");
            if (Files.Exists())
                TextReader trs = new StreamReader(AppFolder + "/ServURL.txt");
                Job.ServiceIP = trs.ReadToEnd();
                //Create ServURL.txt

                var jfs = new Java.IO.File(Path.Combine(AppFolder, "ServURL.txt"));
                var jfw = new Java.IO.FileWriter(jfs);

                TextReader trs = new StreamReader(AppFolder + "ServURL.txt");
                Job.ServiceIP = trs.ReadToEnd();
                Toast.MakeText(this, "Creating IP File", ToastLength.Short).Show();



Sign In or Register to comment.