imgcache.js icon indicating copy to clipboard operation
imgcache.js copied to clipboard

Setting localCacheFolder option to externalDirectory on Android does not download images

Open JcDenton86 opened this issue 9 years ago • 4 comments

I am using successfully ImgCache with my application on Android. I have set the localCacheFolder to "photos" and the images are downloaded as they should. Now I want to store the images inside the persistent and private data storage on external memory. I am trying to set the localCacheOption like this:

ImgCache.options.localCacheFolder = cordova.file.externalDataDirectory+"photos";

The above path is this: file:///storage/emulated/0/Android/data/package.name/files/photos

But the application hangs without giving any errors. Can ImgCache accept such a path?

My setup is: ImgCache 1.0rc1 Cordova 5.0.0 Angular 1.3.1

EDIT: I get erros in the console but I had debug option disabled. That's the error:

ERROR: Failed to get/create local cache directory: 5", source: file:///android_asset/www/js/imgcache.js

JcDenton86 avatar Jun 11 '15 13:06 JcDenton86

I've found that ImgCache only creates a single folder for you, all of the parent folders need to exist. So in your case, you'll need to ensure file:///storage/emulated/0/Android/data/package.name/files exists before calling ImgCache

clivefrog avatar Jun 12 '15 01:06 clivefrog

Thanks clivefrog. @JCDenton86 : did this comment help you there?

chrisben avatar Oct 31 '15 14:10 chrisben

I have the same error. How can i use a folder inside the app so when i uninstall the app it clears also the cache folder?

mtshare avatar Nov 11 '15 17:11 mtshare

Any suggestions?

mtshare avatar Nov 13 '15 02:11 mtshare