Hey guys,
I am currently working on getting my app setup to allow users to download new content to the existing app. I am still in testing phase so what I am trying to accomplish is rather easy. In fact I have it fully working in the Simulator, but on the devices (both IOS and Android), I have issues.
I download a .tar file, which I extract to the system.DocumentsDirectory. Once it is finished, I am trying to display one of the images that was inside the .tar file, just to confirm that it has worked. On the sim, everything goes smoothly and the image is displayed. On my devices, I get notifications (that I put in for testing), that the file finished download and that it was successfully extracted. But no image ever shows up. here is the code. Is there something I am missing in regards to accessing the system.DocumentsDirectory?
local function onExtractComplete() native.showAlert( "BoM Touch", "test.tar" .. " extracted in :" .. system.getTimer() .. " ms", {"Okay"} ) --This is the image I am attempting to display, works on Sim, not on device local testImage = display.newImageRect("Volume2/story1/page1/page1.png", system.DocumentsDirectory, 570, 360) testImage.x = midX + global.imgWidth testImage.y = midY mainMenuGroup:insert(testImage) end local function downloadnetworkListener( event ) if ( event.isError ) then print ( "Network error - download failed" ) native.showAlert( "BoM Touch", "Download error", {"Okay"} ) else --native.showAlert( "BoM Touch", event.response, {"Okay"} ) --Extract the file tar.untar("volumetwo.tar", system.TemporaryDirectory, system.DocumentsDirectory, onExtractComplete) end end local testDownload = function() network.download( "http://myServerURLhere", "GET", downloadnetworkListener, "volumetwo.tar", system.TemporaryDirectory ) end --This gets called elsewhere in my code local startDownload = function( event ) if event.phase == "release" then native.showAlert( "BoM Touch", "download started", {"Okay"} ) testDownload() end end
Does anyone have any thoughts on what might be going on here? Thanks in advance