networkRequest problem

Hey there… I have an app that download an xml from internet and store this in a temporarydirectory…

my problem is… If I open my app without connection I get my error msg but if I open with internet connection and after that I exit my app, turn off my internet and re-open my app… I don`t get the network error msg
it’s seems that my .xml still there, but if I close my app the xml should be deleted no?

-- in splashScene I have put this in my code:  
  
function onSystemEvent( event )   
 if "applicationSuspend" == event.type or "applicationExit" == event.type then  
 local destDir = system.TemporaryDirectory -- where the file is stored  
 local results, reason = os.remove( system.pathForFile( "noticias.xml", destDir ) )  
   
 if results then  
 print( "file removed" )  
 else  
 print( "file does not exist", reason )  
 end  
 --\> file does not exist apple.txt: No such file or directory  
  
 end  
 end   
  
 Runtime:addEventListener( "system", onSystemEvent )  
  
------------------------------------------------------  
------------------------------------------------------  
  
-- and in my menu.lua I have this code to download my xml:  
  
chegaConexao = function()  
 local function networkListener( event )  
 if ( event.isError ) then  
  
 local function onComplete( event )  
 if "clicked" == event.action then  
 local i = event.index  
 if 1 == i then  
 native.setActivityIndicator( false )  
 end  
 end  
 end  
   
 -- Show alert with five buttons  
 local alert = native.showAlert( "Error", "Network issue",   
 { "OK" }, onComplete )   
 print ( "Network error - download failed" )  
  
 else  
 print( "download xml" )  
 native.setActivityIndicator( false )  
 end  
 print ( "RESPONSE: " .. event.response )  
 end  
  
 network.download( "http://www.universopositivo.com.br/iphone/noticias.xml", "GET", networkListener, "noticias.xml", system.TemporaryDirectory )  
 native.setActivityIndicator( true )  
  
 \_G.carregarXMLs = false  
 end  
  
 if \_G.carregarXMLs == true then  
 timer.performWithDelay( 500, chegaConexao, 1 )  
 end   
  
-- and down there I have put this to control if app suspend:  
  
function onSystemEvent2( event )   
 if "applicationResume" == event.type then  
 local function networkListener( event )  
 if ( event.isError ) then  
  
 local function onComplete( event )  
 if "clicked" == event.action then  
 local i = event.index  
 if 1 == i then  
 native.setActivityIndicator( false )  
 end  
 end  
 end  
   
 -- Show alert with five buttons  
 local alert = native.showAlert( "Error", "Network issue",   
 { "OK" }, onComplete )   
 print ( "Network error - download failed" )  
  
 else  
 print( "download xml" )  
 native.setActivityIndicator( false )  
 end  
 print ( "RESPONSE: " .. event.response )  
 end  
  
 network.download( "http://www.universopositivo.com.br/iphone/noticias.xml", "GET", networkListener, "noticias.xml", system.TemporaryDirectory )  
 native.setActivityIndicator( true )  
 end  
 end   
  
 Runtime:addEventListener( "system", onSystemEvent2 )  
  

this problem is going me crazy

someone from ansca or not can help me???
please

thanks
[import]uid: 23063 topic_id: 16472 reply_id: 316472[/import]

I have test here and when I turn off the internet and open my app… he still downloading the XML ( how he do that??! )

I receive the mensage that the download of xml is done :S
someone can please help me? [import]uid: 23063 topic_id: 16472 reply_id: 61495[/import]

Ignore my post… I have solved the problem…

I have put a network.request before the network.download to check internet connectivity and works fine now… so far…
problem solved (Y) [import]uid: 23063 topic_id: 16472 reply_id: 61583[/import]