2
我的应用程序我使用phonegap构建为android编译它。我需要创建一个持久的文件夹来存储一些音频文件,但我不能使它工作...这里是我的代码:config.xml中无法获取getDirectory在Android设备上使用phonegap
<gap:plugin name="org.apache.cordova.file" version="0.2.4" />
在我的index.html:
document.addEventListener("deviceready", onDeviceReady, false);
// device APIs are available
//
function onDeviceReady() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
}
function gotFS(fileSystem) {
fileSystem.root.getDirectory("mynewfolder", {create: true}, gotDir);
console.log(fileSystem.root);
}
function gotDir(dirEntry) {
dirEntry.getFile("myfile.txt", {create: true, exclusive: true}, gotFile);
}
function gotFile(fileEntry) {
// Do something with fileEntry here
}
我没有解释你有一些线索吗?控制台什么都不给。
感谢您的帮助。事实上,它的失效功能是有效的! –