Coding support for a bluetooth controller which is read via nativeApplication keyboardevents.key_up & key_down. All works well, but I noticed sometimes the connection between the controller and the app seems to get lost, which causes the keyboard events to not work which occasionally results in a ANR error causing the app to be shut down due to keyboard events not being processed. Now the interesting thing is, by removing and adding the listeners once in a while seems to have solved the issue. I was hoping there was a way to "flush" the keyboard events once in a while which might have helped but I didn't find anything so this was the step taken. Do you think under the hood by removing and adding the event listeners once in a while, this is in effect flushing/restarting the handler? Also, for generic key press handling are these the right parameters to use in the addlistener function? Thanks for any comments.
NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown, false, 1, true);
NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_UP, onKeyUp, false, 0, true);