Note that there are some explanatory texts on larger screens.

plurals
  1. POPhoneGap - saving data to local file system (File API)
    primarykey
    data
    text
    <p>I just started to play with <a href="http://docs.phonegap.com/en/2.4.0/cordova_file_file.md.html#File" rel="nofollow">File API</a> of PhoneGap and already have some problems with saving process. Here is the javascript code:</p> <pre><code>function saveCourseToFile() { console.log("checkpoint 1"); window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFSSuccess, onFSError); } function onFSSuccess(fileSystem) { console.log("checkpoint 2"); console.log("Opened file system: " + fileSystem.name); fileSystem.root.getFile("course.oerk", {create:true, exclusive:false}, gotFileEntry, onFSError); } function gotFileEntry(fileEntry) { console.log("checkpoint 3"); fileEntry.createWriter(gotFileWriter, onFSError); } function gotFileWriter(writer) { writer.onwrite = function(evt) { console.log("checkpoint 4: write success!"); }; writer.write("test test test"); } function onFSError(err) { console.log(err.code); } </code></pre> <p><strong>UPDATE:</strong></p> <pre><code>&lt;script type="text/javascript"&gt; function init() { document.addEventListener("deviceready", onDeviceReady, false); } &lt;/script&gt; &lt;body onload="init()"&gt; &lt;div id="page1"&gt; &lt;a href="#page2"&gt;Click me&lt;/a&gt; &lt;/div&gt; &lt;div id="page2"&gt; &lt;script type="text/javascript"&gt; saveCourseToFile(); &lt;/script&gt; &lt;p&gt;Text text text text&lt;/p&gt; &lt;/div&gt; &lt;/body&gt; </code></pre> <p>But in the device file system no such file (course.oerk) as a result. Here is a piece of logcat:</p> <pre><code>02-18 22:36:55.542: D/Cordova(746): onPageFinished(file:///android_asset/www/index.html#coursesPage) 02-18 22:36:55.542: D/Cordova(746): Trying to fire onNativeReady 02-18 22:36:55.552: D/DroidGap(746): onMessage(onNativeReady,null) 02-18 22:36:55.552: D/DroidGap(746): onMessage(onPageFinished,file:///android_asset/www/index.html#coursesPage) 02-18 22:36:56.223: I/Choreographer(746): Skipped 36 frames! The application may be doing too much work on its main thread. </code></pre> <p>Any help would be appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload