title: How to INSERT DATA in CLOUDANT DATABASE from ANDROID APP
body: <p>I am working on a <strong>ANDROID APP</strong> which's database is <strong>CLOUDANT</strong> stored on <strong>IBM's</strong> cloud. Actually I am working on PERSONALITY INSIGHTS service of <strong>IBM</strong>. I want to store quiz data to <strong>CLOUDANT</strong> database of specific user. I have manually added 2(Two) documents to <strong>CLOUDANT</strong> database. But I can not find the documentation to insert data to <strong>CLOUDANT</strong> database via <strong>ANDROID APP</strong>.</p>
  <p><a href="https://cloudant.com/for-developers/crud/#pageArea" rel="nofollow noreferrer">Insert Doc to <strong>CLOUDANT</strong> database</a></p>
  <p>The above link provides documentation for <strong>Reading &amp; Inserting Doc to CLOUDANT Database</strong> under heading of <strong>Insert &amp; Read A Document</strong> but not for <strong>ANDROID.</strong></p>
  <p><a href="https://github.com/cloudant/sync-android" rel="nofollow noreferrer">Sample Android App GitHub - CLOUDANT</a></p>
  <p>I was referring above link but I think that example is out of syllabus for me.</p>
  <p>What I have tried till is like below..</p>
  <p>build.gradle</p>
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 23
      buildToolsVersion &quot;23.0.2&quot;
  
      defaultConfig {
          applicationId &quot;com.example.android02.cloudant_db_demo_app&quot;
          minSdkVersion 15
          targetSdkVersion 23
          versionCode 1
          versionName &quot;1.0&quot;
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  repositories {
      mavenLocal()
      mavenCentral()
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      testCompile 'junit:junit:4.12'
      compile 'com.android.support:appcompat-v7:23.1.1'
  
      compile (group: 'com.cloudant', name: 'cloudant-sync-datastore-android', version:'latest.release')
  }
  </code></pre>
  <p>settings.xml</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;resources&gt;
      &lt;string name=&quot;default_user&quot;&gt;USERNAME&lt;/string&gt;
      &lt;string name=&quot;default_dbname&quot;&gt;DATABASE&lt;/string&gt;
      &lt;string name=&quot;default_api_key&quot;&gt;API KEY&lt;/string&gt;
      &lt;string name=&quot;default_api_password&quot;&gt;API PWD&lt;/string&gt;
  &lt;/resources&gt;
  </code></pre>
  <p>MainActivity.java</p>
  <pre><code>package com.example.android02.cloudant_db_demo_app;
  
  import android.os.Bundle;
  import android.support.v7.app.AppCompatActivity;
  
  import com.cloudant.sync.datastore.MutableDocumentRevision;
  
  public class MainActivity extends AppCompatActivity {
  
      static final String SETTINGS_CLOUDANT_USER = &quot;USERNAME&quot;;
      static final String SETTINGS_CLOUDANT_DB = &quot;DATABASE&quot;;
      static final String SETTINGS_CLOUDANT_API_KEY = &quot;API KEY&quot;;
      static final String SETTINGS_CLOUDANT_API_SECRET = &quot;API PWD&quot;;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          MutableDocumentRevision rev = new MutableDocumentRevision();
      }
  }
  </code></pre>
  <p>I can also read the data through 
  <code>https://$USERNAME.cloudant.com/$DATABASE/_all_docs.</code> in browser.</p>
  <p><a href="https://i.stack.imgur.com/F3Tpe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F3Tpe.png" alt="Getting Data Image" /></a></p>
  <p>Any help will be very very appreciable. Thanks in advance.</p>