Runtime Event Listener called twice?

We have an issue on IOS where it seems that the event listener is being called twice.  Does anyone know why this could be: -

Runtime:addEventListener( “location”, locationHandler ) 

Should we be checking for phase on this?

We don’t see it on Android…

Print out the contents of the whole “event” table to see if this gives your more information about phase etc…

Another source of error could be that the eventListener is added twice for some reason. Trying adding a print statement right after the line of code where you add this eventListener to confirm it’s only added once.

A simple hack to stop double firing…

local canProcess = true local function locationHandler(event) if canProcess then canProcess = false .... your location code here .... timer.performWithDelay(500, function() canProcess = true end) -- add a 500ms lock on processing end end Runtime:addEventListener( "location", locationHandler )

Print out the contents of the whole “event” table to see if this gives your more information about phase etc…

Another source of error could be that the eventListener is added twice for some reason. Trying adding a print statement right after the line of code where you add this eventListener to confirm it’s only added once.

A simple hack to stop double firing…

local canProcess = true local function locationHandler(event) if canProcess then canProcess = false .... your location code here .... timer.performWithDelay(500, function() canProcess = true end) -- add a 500ms lock on processing end end Runtime:addEventListener( "location", locationHandler )