Hey, @ garethward, I test the network connectivity first, and if there’s no connection, I don’t unpackValidProducts (but instead, message the user to turn on Wi-Fi.) I use the code below for this purpose. I hope this helps.
Naomi
[lua] – test to see if network connection is available
local isSimulator = system.getInfo(“environment”) == “simulator”
local function testNetworkConnection()
local netConn = require(‘socket’).connect(‘www.apple.com’, 80)
if netConn == nil then
return false
end
netConn:close()
return true
end
if isSimulator or not testNetworkConnection() then
local function doNotUnpack()
– use this function to message the user
end
timerStash.newTimer = timer.performWithDelay (1000, doNotUnpack);
else
timerStash.newTimer = timer.performWithDelay (1000, unpackValidProducts);
end[/lua] [import]uid: 67217 topic_id: 22701 reply_id: 90579[/import]