title: write/read to file in cordova hybrid android app
body: <p>I want to be able to write/read to file in cordova app.  </p>
  
  <p>the steps I've did:<br>
   1. ..>cordova create app<br>
   2. app>cordova platform add android<br>
   3. app>cordova plugin add <a href="https://git-wip-us.apache.org/repos/asf/cordova-plugin-file.git" rel="nofollow">https://git-wip-us.apache.org/repos/asf/cordova-plugin-file.git</a><br>
   4. <em>here I've added following code to the project</em> and added to the manifest:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;  
  </code></pre>
  
  <p>and added to config.xml:</p>
  
  <pre><code>&lt;feature name="File"&gt;
      &lt;param name="android-package" value="org.apache.cordova.FileUtils" /&gt;
  &lt;/feature&gt;
  </code></pre>
  
  <p>5.app>cordova build<br>
   6. app>cordova run android<br>
   7. <em>output on my android device:</em></p>
  
  <pre><code>a. onready    
  b. fail: Class not found.
  </code></pre>
  
  <p>Why I get this error in the line: window.requestFileSystem(...)?</p>
  
  <pre><code>&lt;script type="text/javascript" charset="utf-8" src="cordova.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" charset="utf-8"&gt;
  
  // Wait for device API libraries to load
  //
  document.addEventListener("deviceready", onDeviceReady, false);
  
  // device APIs are available
  //
  function onDeviceReady() {
      alert('onready');
      window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
  }
  
  function gotFS(fileSystem) {
      alert('gotFS');
      fileSystem.root.getFile("readme.txt", {create: true, exclusive: false}, gotFileEntry, fail);
  }
  
  function gotFileEntry(fileEntry) {
      fileEntry.createWriter(gotFileWriter, fail);
  }
  
  function gotFileWriter(writer) {
      writer.onwriteend = function(evt) {
          console.log("contents of file now 'some sample text'");
          writer.truncate(11);
          writer.onwriteend = function(evt) {
              console.log("contents of file now 'some sample'");
              writer.seek(4);
              writer.write(" different text");
              writer.onwriteend = function(evt){
                  console.log("contents of file now 'some different text'");
              }
          };
      };
      writer.write("some sample text");
  }
  
  function fail(error) {
      alert('fail: '+error.code);
  }
  
  &lt;/script&gt;
  </code></pre>