title: How to connect xamarin android app to Cloud Firestore db
body: <p>I have tried many ways as in several sites but no luck, I tried to connect it using <code>Google.Cloud.Firestore</code> and <code>Google.Apis.Storage.v1</code> Nuget packages. The code is given below.</p>
  
  <pre><code>Google.Cloud.Firestore.FirestoreDb db = Google.Cloud.Firestore.FirestoreDb.Create("test");
          CollectionReference collection = db.Collection("users");
          DocumentReference document = await collection.AddAsync(new { email = "xamemail@12", name = "xamemail" });
  </code></pre>
  
  <p>When I tried this code one exception occurred like environment variable GOOGLE_APPLICATION_CREDENTIALS not set, then I set GOOGLE_APPLICATION_CREDENTIALS in my windows system  as well as in the code as shown below.</p>
  
  <p><code>System.Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", @"C:\\path-to-json", EnvironmentVariableTarget.Machine);</code></p>
  
  <p>It's showing another error the file is not found in the path, but its there and I set the permission for the path.</p>
  
  <p>If anyone there to help on this, anyone already using a xamarin - cloud firestore db in your projects?</p>
  
  <p>Please note its not the firebase realtime db, I am able to connect that.</p>