title: C# Xamarin android File creation\writing and SQLite
body: <p>This is my first post, but I have been scouring the stack for how I might use a text file or a SQLite database in Xamarin for Visual Studio. All the examples I have found end up in java, or in the old Mono android code.</p>
  
  <p>The jist of the application is to read GPS data, display it, and save the latitude and longitude along with some identifying info such as room number. I have the display portion of the app working nicely, so now I need to find a way to save the information, so that the data can be passed along to a future class to finish creating a campus navigation app.</p>
  
  <p>Here are some of the related portions:</p>
  
  <pre><code>path = GetDir("MCCMapping/",FileCreationMode.Append).ToString();
  </code></pre>
  
  <p>I am not sure this is correct to set the directory for the file creation.</p>
  
  <pre><code>String location = String.Format("{0}|{1}|{2}|{3}", roomNum.Text, campus.SelectedItem.ToString(), current.Latitude.ToString(),
                                               current.Longitude.ToString());
                  using (data_file = new StreamWriter(path+"/MCC_ROOM_DATA.txt", true))
                  {
                      data_file.WriteLine(location);
                  }
  </code></pre>
  
  <p>This is not quite working. I need to be able to access the .txt file from outside the application, or even implement a SQLite database to store the same information. I have all the necessary manifest permissions. My device does not have external storage, so it will emulate it if that is the route that must be taken.</p>
  
  <p>Anything you might have to help me along would be appreciated. Thanks.</p>
  
  <p>Update 1: </p>
  
  <pre><code>folder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
              conn = new SQLiteAsyncConnection(System.IO.Path.Combine(folder, "MCC_ROOMS.db"));
              conn.CreateTableAsync&lt;Room&gt;().ContinueWith(t =&gt; {});
  </code></pre>
  
  <p>and this </p>
  
  <pre><code>public class Room
  {
      [PrimaryKey, AutoIncrement]
      public int Id { get; set; }
      public string Campus { get; set; }
      [Unique]
      public string Room_Num { get; set; }
      [Unique]
      public decimal Room_Latitude { get; set; }
      [Unique]
      public decimal Room_Longitude { get; set; }
  }
  </code></pre>
  
  <p>I am not quite sure what to put in the continue with portion. Also, would this allow me to access the table from a different application later? Thanks.</p>
  
  <p>Update 2: Thanks to Jason, I have a working application. I used the external storage directory that is built in, and can then access the file if I turn usb debugging off.</p>