window.requestFileSystem 在 android phonegap 中失败

window.requestFileSystem fails in android phonegap

本文关键字:失败 phonegap android requestFileSystem window      更新时间:2023-09-26

我在android中使用window.requestFileSystem。但它失败,错误代码为 9。我已经在这里阅读了安卓设备没有SD卡的问题。这是我正在使用的代码

window.requestFileSystem(2, 0, function(file_system) {
                console.log('got fs');
                callback(null, file_system);
            }, function(err) {
                console.log('not getting library fs'+err.code);
                callback(err);
            });

如何在安卓中使用它?

根据官方文件,requestFileSystem中的第一个参数应该是常数LocalFileSystem.PERSISTENTLocalFileSystem.TEMPORARY

请尝试以下标准语句:

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(f){ /* sucess */ }, function(e){ /* error */);