In the old days, writing for Windows and OS/2, we had a message queue that we tapped into by including the message “name” in the switch. There were thousands of messages that we never saw, unless we specifically included the name. We could post or send messages (placing them with different priorities) to the message queue for our own communication or to communicate with the various devices and services within the environment.
With Corona/Lua, we create an event listener which taps into the app’s message queue. We intercept the message via the listener, and allow it to continue to pass down the chain or end by the return value (true/false).
The Runtime:addEventListener(“enterFrame”, <listener>) appears to follow the first scenerio - meaning that the messages are always there, timed based upon the value set in config.lua. Does this hold true in the other listeners? or does the setting of the listener trigger their particular events to post. I’m specifically looking at hardware related events.
If the messages are always there and we just need to tap them, the coding is rather straight forward. In the GPS, you would just listen for the message and ignore/throw away any events outside of your time or distance threshold. If the addEventListener actually starts that particular message, there would be reason to believe that the removeEventListener would stop that message - and other things associated with it (such as GPS signal acquisition) would be impacted.
Could one of the Corona engineers chime in here on how this works. I believe it would have a big impact on how developers address the use of these listeners.
Thanks
Dave