mramonlopez / cordova-plugin-file-downloader

Phonegap plugin to download a list of files or a single file to the phone, check consistency and unzip if necessary (Android and ios)
MIT License
23 stars 19 forks source link

resolveLocalFileSystemURI is deprecated. Please call resolveLocalFileSystemURL instead. #8

Closed alexpvieira closed 5 years ago

alexpvieira commented 5 years ago

Hi there.

Nice work on this plugin. I was trying to use it on a new project but got this error back:

resolveLocalFileSystemURI is deprecated. Please call resolveLocalFileSystemURL instead.

This is my complete code:

let storage_location = ''

if (this.$q.platform.is.ios) {
   storage_location = cordova.file.documentsDirectory
}
else if (this.$q.platform.is.android) {
   storage_location = 'file:///storage/emulated/0/'
}

downloader.init({folder: 'download', fileSystem: storage_location})
downloader.get(this.library.file_url_complete)

Any clues on what can be causing this? Thanks.

rxluz commented 4 years ago

Same problem here, any idea why this is happening?

georrge1994 commented 4 years ago

so where is solution?

pablohastings commented 4 years ago

I am also getting this error on Android. I do not get it on iOS.

Suryalg commented 3 years ago

Why this is closed? any solution to this?

rolinger commented 3 years ago

@alexpvieira - alex must have figured this out because he closed his own issue. Several others might still be looking for the fix though:

The original plugin by @fastrde was written several years ago when the fileSystem was referenced as resolveLocalFileSystemURI. when @mramonlopez forked and updated it he didn't make changes that accounted for the file system changes. Somewhere in 2018 cordova-plugin-file changed the file system reference to resolveLocalFileSystemURL

As far as I can tell this only impacts the plugin when using the fileSystem option (ie: downloader.init({folder: 'download', fileSystem: storage_location}), to fix this, you will need to mod the src code, in the plugin's src/downloader.js file, line 451 needs to be updated from:

resolveLocalFileSystemURI to resolveLocalFileSystemURL

rolinger commented 3 years ago

This is a related fileSystem path issue, has anyone on this thread dealt with it....or know whats going on? Trying to look at the source code to find what could be causing it but so far no luck.

@alexpvieira @rxluz @pablohastings @georrge1994 @Suryalg

https://github.com/mramonlopez/cordova-plugin-file-downloader/issues/18