imgcache.js
imgcache.js copied to clipboard
Setting localCacheFolder option to externalDirectory on Android does not download images
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
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
Thanks clivefrog. @JCDenton86 : did this comment help you there?
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?
Any suggestions?