title: Phonegap (Cordova) doesn't write file to Android
body: <p>I'm having a frustrating issue getting cordova to write files to Android devices.</p>
  
  <p>According to the log, everything is firing correctly and the plugin methods are responding with successes etc, but when I go searching for the files they're no where to be found.</p>
  
  <p>Currently I'm just using a fresh phonegap test application and I followed the following guide and used their example code verbatim. The plugins are installed according to the logs are executing.</p>
  
  <p><a href="http://docs.phonegap.com/en/edge/cordova_file_file.md.html" rel="nofollow">http://docs.phonegap.com/en/edge/cordova_file_file.md.html</a></p>
  
  <p>I'm expecting the file to show up in /android/data/com.testapp.myapp/files</p>
  
  <p>This is my test code:</p>
  
  <pre><code>var app = {
      // Application Constructor
      initialize: function() {
          this.bindEvents();
      },
      // Bind Event Listeners
      //
      // Bind any events that are required on startup. Common events are:
      // 'load', 'deviceready', 'offline', and 'online'.
      bindEvents: function() {
          document.addEventListener('deviceready', this.onDeviceReady, false);
      },
      // deviceready Event Handler
      //
      // The scope of 'this' is the event. In order to call the 'receivedEvent'
      // function, we must explicitly call 'app.receivedEvent(...);'
      onDeviceReady: function() {
          app.receivedEvent('deviceready');
          window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, app.gotFS, app.fail);
      },
  
      // Update DOM on a Received Event
      receivedEvent: function(id) {
          var parentElement = document.getElementById(id);
          var listeningElement = parentElement.querySelector('.listening');
          var receivedElement = parentElement.querySelector('.received');
  
          listeningElement.setAttribute('style', 'display:none;');
          receivedElement.setAttribute('style', 'display:block;');
  
          console.log('Received Event: ' + id);
      },
  
      gotFS: function(fileSystem) {
          fileSystem.root.getFile("testFile.txt", {create: true, exclusive: false}, app.gotFileEntry, app.fail);
      },
  
      gotFileEntry: function(fileEntry) {
          fileEntry.createWriter(app.gotFileWriter, app.fail);
      },
  
      gotFileWriter: function(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");
  
      },
  
      fail: function() {
          alert("failed");
      }    
  };
  </code></pre>
  
  <p>And here are the log entries from the logCat showing it firing off:</p>
  
  <pre><code>09-26 07:24:37.991 I/chromium( 2027): [INFO:CONSOLE(49)] "Received   
  
  Event: deviceready", source: file:///android_asset/www/js/index.js (49)
  09-26 07:24:38.591 D/TEST    ( 2027): cdvfile://localhost/persistent/testFile.txt: 16
  09-26 07:24:39.063 I/chromium( 2027): [INFO:CONSOLE(62)] "contents of file now 'some sample text'", source: file:///android_asset/www/js/index.js (62)
  09-26 07:24:39.075 D/TEST    ( 2027): cdvfile://localhost/persistent/testFile.txt: 15
  09-26 07:24:39.155 I/chromium( 2027): [INFO:CONSOLE(65)] "contents of file now 'some sample'", source: file:///android_asset/www/js/index.js (65)
  09-26 07:24:39.363 I/chromium( 2027): [INFO:CONSOLE(69)] "contents of file now 'some different text'", source: file:///android_asset/www/js/index.js (69)
  </code></pre>
  
  <p>Any insight to why this maybe happening would be great.</p>
  
  <p>Thanks!</p>