To frequent RSSI events

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

I use a very similar method but would add to the top of that function:

[lua]local status = network.getConnectionStatus() – Undocumented see http://forums.coronalabs.com/topic/32644-any-tips-to-get-network-status/

if not status.isConnected then 

  return false

end[/lua]

That way you are not attempting connect if there is no network on the device and avoiding hang/crash in that case.

I checked my console for “Too frequent(0.354588 secs) rssi event from driver, ignoring” but I’m not seeing it. Hopefully someone else can chime in regarding that.

Thanks - good point. I’ve run some more tests and this issue seems to occur with some other apps, so I wonder if it’s a general thing on my iPad rather than being specific to this app. Be interested to know why that poster had used Corona as an example of what could cause this though.

I use a very similar method but would add to the top of that function:

[lua]local status = network.getConnectionStatus() – Undocumented see http://forums.coronalabs.com/topic/32644-any-tips-to-get-network-status/

if not status.isConnected then 

  return false

end[/lua]

That way you are not attempting connect if there is no network on the device and avoiding hang/crash in that case.

I checked my console for “Too frequent(0.354588 secs) rssi event from driver, ignoring” but I’m not seeing it. Hopefully someone else can chime in regarding that.

Thanks - good point. I’ve run some more tests and this issue seems to occur with some other apps, so I wonder if it’s a general thing on my iPad rather than being specific to this app. Be interested to know why that poster had used Corona as an example of what could cause this though.