Network Detection for Nook/ Android- event.isReachable

I have some code that will launch a web pop up but only if a network connection can be detected. I’m using google.com as the network address. here is the code:

network.setStatusListener(“www.google.com”, showCompanyInfo)

local function showCompanyInfo(event)
if(event.isReachable == false) then
–> Display error, connection is required.

else
native.showWebPopup(0, 0, …)
end
end

My code is working great using event.isReachable on the iPad/ iPhone but it doesn’t work for Android or the Nook.

Is event.isReachable not supported on the Android/ Nook and if not, what works?

thanks,
Rob [import]uid: 38348 topic_id: 19171 reply_id: 319171[/import]

I figured it out. Instead of using network.setStatusListener, which doesn’t work on the Nook or my android phone (Evo 4G)… I used network.request(“http://google.com”, callbackMethodName)

that worked for what I needed and seems to work on the iPad, android phone and Nook Tablet… now to test on the Kindle Fire. I’ll be back if it doesn’t work. [import]uid: 38348 topic_id: 19171 reply_id: 74102[/import]

Hey sondlerd,
Is that proving to be a reliable detection mechanism? I’ll be doing some similar things in the near future and would be thrilled to know if that’s a solid solution.

-Joe [import]uid: 32462 topic_id: 19171 reply_id: 77612[/import]

Hey Joe,

Yes, that is the solution I went with. It works great and I used it for my published game on Android, IOS, Nook and Kindle Fire builds.

I only had one external page I wanted to display. So my approach was to check the connection (every time) using the url of the page the app displays and then set the callback to the method that opens the web pop up. So, the button had an event listener that checked the connection and the network.request(… method called the code that opens the web popup.

Cheers,
Rob [import]uid: 38348 topic_id: 19171 reply_id: 77620[/import]

Awesome. Thanks for sharing! [import]uid: 32462 topic_id: 19171 reply_id: 77621[/import]