When I test this (turning wifi on and off), it seems to cache the results of the first url call. I included code that unloads the last url cache, but I don't think Livecode counts the unsuccessful url calls in its cache.
Here is the code:
Code: Select all
put 1 into tnum
repeat until tresult = "Updated and emailed to your employer."
//I added the next two lines to see if it would solve the cache issues, but it didn't
put cachedURLs() into tcache
unload URL the last line of cachedURLs()
put url(turl) into tresult
if tresult = "Updated and emailed to your employer." then
set the label of button "reported" to "Sent Date/time: " & the date & the time
set the vis of button "reported" to true
shutdownrequest
else
answer tresult //testing to make sure it is still sending the request
if tnum is 1 then
answer "The internet is not available. While this app is open, we will continue to send your message every 5 seconds."
put 2 into tnum //so the message isn't repeated
end if
end if
wait 5 secs
end repeat
Is there some way I can get the url(turl) to REALLY try each time, rather than just repeat its first result? Or is there a better way to accomplish my goal?
I should say that I am testing this on Windows, but need it to actually work on IOS and Android. It is possible that the caching isn't an issue on a mobile device. I don't know how all of this works...
Thanks!