Ok,
I have this at the top of my main.lua file
[lua]local function MyNetworkReachabilityListener(event)
print( “address”, event.address )
print( “isReachable”, event.isReachable )
print(“isConnectionRequired”, event.isConnectionRequired)
print(“isConnectionOnDemand”, event.isConnectionOnDemand)
print(“IsInteractionRequired”, event.isInteractionRequired)
print(“IsReachableViaCellular”, event.isReachableViaCellular)
print(“IsReachableViaWiFi”, event.isReachableViaWiFi)
end
if network.canDetectNetworkStatusChanges then
network.setStatusListener( “www.mywebsite.com”, MyNetworkReachabilityListener )
else
print(“network reachability not supported on this platform”)
end[/lua]
then I have a button that is going to call a function to load a webPopup. I want to make sure that before the webpopup shows that I have established that Wifi is on… if it isn’t then I want to just leave the screen as is and send an alert saying connect to wifi etc.
This is what I have that doesn’t work.
[lua]local function showVideos (event)
if event.phase == “release” then
media.playEventSound( “Tock.caf” )
if event.isReachableViaWiFi == “false” then
local alert = native.showAlert(“No Wifi Detected”, “Please connect and try again”, {“OK”})
else
mainScreen:slideToLeft( videosScreen )
buttons.isVisible = false
options2 = { hasBackground=false}
native.showWebPopup(0,42,320,400, “http://www.mywebsite.com/videos.php”, options2)
bottomBar.isVisible = true
back.isVisible = true
end
end
videosScreen:addBackButton(goBack2)
end
local button2 = ui.newButton{
default = “buttonRed.png”,
over = “buttonRedOver.png”,
text = “Videos”,
onEvent = showVideos,
emboss = true
}[/lua]
Any help would be greatly appreciated. I am sure I am missing something real simple.
Matt [import]uid: 18783 topic_id: 11054 reply_id: 311054[/import]
[import]uid: 3826 topic_id: 11054 reply_id: 40257[/import]