我正在使用官方file API Plugin 在我的cordova应用程序中,它在我的Android设备上正常工作,除了谁有 Android 6.0.1 。
无法创建目录,并抛出错误编号 2 ,即SECURITY_ERR
JS代码:
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (response) {
response.root.getDirectory("folderNamexxx", {create: true, exclusive: false}, function () {
alert("success");
}, function (e) {
alert(JSON.stringify(e));//error fired here
});
}, function (e) {
alert("error");
});
的AndroidManifest.xml:
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="${applicationId}.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
config.xml中:
<preference name="AndroidPersistentFileLocation" value="Compatibility" />