में पढ़ने फ़ाइल मैं writing/reading
phonegap+android
में एक फ़ाइल की कोशिश की, यहाँ की स्थापना की है:लेखन और phonegap
$(document).ready(function() {
document.addEventListener("deviceready", deviceready, true);
$(document).bind("deviceready", function(){
//writeFile();
//readFile();
});
});
function deviceready() {
writeFile();
readFile();
}
// This is just to do this.
function readFile() {
var d = navigator.file.read('/sdcard/foo.xml', success(), fail());
console.warn(d);
}
function writeFile() {
navigator.file.write('/sdcard/foo.xml', "This is a test of writing to a file",
success(), fail());
}
लेकिन Android 2.2 के लिए एमुलेटर पर, मैं निम्नलिखित त्रुटि संदेश मिला
08-06 14:21:29.428: INFO/Web Console(936): Error in success callback: Network Status1 = TypeError: Result of expression 'navigator.file' [undefined] is not an object. at file:///android_asset/www/phonegap.0.9.6.js:649
क्या गुम हो सकता है और क्या कोशिश की जा सकती है?
हो सकता है कि आप अपने कॉल में सफलता के बजाय सफलता() एक ही उपयोग कर रहे हैं वापस) विफल (के लिए चला जाता है –