I'm using the following method to fix a problem with my snapshot during an app resume:
P.onSystemEvent = function ( event ) if(event.type=="applicationResume") then P.powerGlow:invalidate() end end
I'm registering using the following call:
Runtime:addEventListener( "system", P.onSystemEvent )
And I'm removing with this call:
Runtime:removeEventListener( "system", P.onSystemEvent )
The event registers fine and my snapshot updates as it should when the app resumes. Problem is onSystemEvent is still being fired even after I remove the event listener, obviously indicating a problem with my remove call.
The remove call is returning nil, not true or false as Documentation says it should.
Check out the following debug:
local removeResult = Runtime:removeEventListener( "system", P.onSystemEvent ) print("P.onSystemEvent = " .. tostring(P.onSystemEvent)) print("removeResult = " .. tostring(removeResult))
P.onSystemEvent = function: 10624940 removeResult = nil