It seems that android cache images from network in local.
I write a cordova code for loading images from network if there aren't in local and saw that android cache these images in local when I disabled network(wifi, ...)
Please look at below code.
.directive('fallbackSrc', function ($cordovaFile, Settings, $cordovaNetwork) {
return {
link: function post_link(scope, element, attrs) {
element.bind('error', function () {
element.parent().html('<img src="' + attrs.fallbackSrc + '">');
I want to show images to user if he is not online from local, so for doing it I need images location that already loaded and saved from network.
For doing above approach I wrote below code but because there is not any image at checked location it shows error message.
if ( isOffline ) {
var target = (cordova.file.externalDataDirectory || cordova.file.dataDirectory) + attrs.fallbackSrc.substr(attrs.fallbackSrc.lastIndexOf('/') + 1);
window.resolveLocalFileSystemURL(target, function(file){
parent.html('<img src="' + target + '">');
}, function(error) {
parent.html('<div class="errorImage">error in loading image!</div>');
});
} in above code target file is:
file:///storage/emulated/0/Android/data/com.taher.makeup/files/ar4-2658.jpg
Please let me know does android cache images from network in it's all versions and where saves them?