Hi there,
I’m getting the following trace in the console when running my app:
Too frequent(0.354588 secs) rssi event from driver, ignoring
When I googled this, I came up with the following link, where they seem to link back to a Corona forum, citing it as a “bad example” of poorly written code that can cause your app to poll for a WIFI connection way too often and therefore use up battery life / CPU.
http://stackoverflow.com/questions/22460991/ios-too-frequent-rssi-event-from-driver
Links to the below as an example…
http://forums.coronalabs.com/topic/33356-check-for-internet-connection/
I’m curious as to why this person is saying the above is an example of poor code - unless Corona’s functionality repeatedly polls for a connection under the hood? I thought this code just checked once and if it found no connection, then gave up.
I’m using the following in my app to check for a connection:
local checkNetworkStatus = network.getConnectionStatus() if checkNetworkStatus.isConnected == true then local socket = require("socket"); local test = socket.tcp(); test:settimeout(5); -- Set timeout to 5 seconds -- Note that the test does not work if we put http:// in front local testResult = test:connect("www.mydomain.co.uk", 80); if testResult == nil then print("Internet access is not available"); status = false; else print("Internet access is available"); status = true; end -- Close connection test:close(); test = nil; end
If anyone has any idea of why this wouldn’t just check for a connection once that would be helpful.
Thanks,
Ian