Closed magude closed 6 years ago
I changed the code to SD card & it worked.
startDownload: function () {
console.log("in start download");
window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory, function(dir) {
console.log("got main dir",dir);
dir.getFile(app.fileName, {create:true}, function(file) {
console.log("got the file", file);
app.downloadFile(app.uriString, file);
});
}, app.fail);
},
fail : function(error) {
console.log("nik-error" + error.code + error.message);
},
I had solved the question in java directly. But there are bugs still, e.g. stopping suddenly,not supporting some phone band, not to download next as app is background, not be able to resume from break point. Now, I has used xutils3 , sqlite and aidl and make a new corodva plugin, most work has been put into java native code, only show progress and the list in html and js. I feel the module is stabler than before and suggest Official to do like this.
Hi @magude, we've made a number of improvements related to similar issues. Now it works more stable. I'll close this issue for now but please feel free to reopen it if you have any questions.
Hi,
I think the issue with the lack of SD-Card is still relevant.
I get the following error on Android :
Unsupported path /data/data/xx.xxx.xx/files/464533db5c06cb5437a7f99b2d976cb9.zip.temp
Could it be caused by this line ? https://github.com/sgrebnov/cordova-plugin-background-download/blob/master/src/android/BackgroundDownload.java#L114
Sorry, i read the Android documentation about the DownloadManager and understood that it's an external process that can't write directly to the app directory.
I restart my implementation and it's working ! I probably didn't use the right target directory.
Anyway, thank's for your work Nick !
can make sub-directory in /data/data ,but can't create file. error code like this: Writing exception to parcel java.lang.SecurityException: Unsupported path /data/user/0/***/files/22940/001_mj.mp3.temp at com.android.providers.downloads.DownloadProvider.checkFileUriDestination(DownloadProvider.java:735) at com.android.providers.downloads.DownloadProvider.insert(DownloadProvider.java:558) at android.content.ContentProvider$Transport.insert(ContentProvider.java:263) at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:163) at android.os.Binder.execTransact(Binder.java:453)