Hi thanks for this info, very helpful.
I am having an issue with the image (that was downloaded) staying the same, even after changing the image file on the server.
In other words, if image1.png was downloaded once and then the next day image1.png was changed on the server ( same name but different image ), the app still shows the old image1.png instead of re-downloading it (??) and displaying the new image1.png? Am I mis-understanding how the network.request call works? Shouldn’t it download the image1.png every time it is called?
I clear the temp directory of image1.png right before the network.request() call for the download so I don’t understand why the app still shows the “old” version of image1.png and not the new version of image1.png from the server / download.
Any help would be appreciated.
Cheers!
here is the code I am using:
local function clearTempDir()
local lfs = require “lfs”
local doc_path = system.pathForFile( “”, system.TemporaryDirectory )
local destDir = system.TemporaryDirectory – where the file is stored
for file in lfs.dir(doc_path) do
– file is the current file or directory name
os.remove( system.pathForFile( file, destDir ) )
print("Temp Dir Cleared, removed file: ", file)
end
end
clearTempDir() – to remove former versions of the images that were downloaded before
local params = {}
params.progress = true
network.download(
“http://www.myServer.com/image1.png”,
“GET”,
image1Handler,
params,
“image1.png”,
system.TemporaryDirectory
)